How MS Outlook Broke a SQL Query

I entered some data into a database table in the format of:

[some text] [space] [hyphen] [space] [some more text]

Here’s an example:

I then emailed a coworker the specific criteria to use for a query. I said something like:

Make sure the query looks for this:

FL - Orlando

FL - Miami

The SQL looked something like this:

SELECT * FROM myTable
WHERE myField IN ('FL - Orlando','FL - Miami')

Upon running the query, there were mysteriously no results.

MS Outlook was the culprit

The SQL was fine, however when I typed the request into MS Outlook, it changed the hyphen to a dash . The “-” changed size!

The data stored in my database used a hyphen, but it was querying for a dash.

There’s a setting in MS Outlook to automatically convert a hyphen to a dash. It’s in the “AutoFormat As You Type”. For me, it’s turned on my default.

Basically:

  • FLOrlando // what was queried
  • FL - Orlando // value in the database

The size of the hyphen/dash caused an exact match to NOT be found, as it was looking for the wrong character.

Even typing this post on Medium, there were auto-formatting issues that turned the hyphen into a dash and I had to make sure the right one was being shown!

stevesohcot.com

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Test-Driven Development Tutorial for iOS

Solve an interesting problem by using DP, BFS and Dijkstra

8 Active Learning Insights of Python Collection Module

Progressive Web Apps: The next big thing?

| Engineering News-Record

Ethereum 2.0 Development Update #38 — Prysmatic Labs

BitTorrent Class|How do I pause or delete a torrent?

Terra Eyes Community Update

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Steve Sohcot

Steve Sohcot

stevesohcot.com

More from Medium

How to use random values in Postman

How to export all Views from a database

How to export all Views from a database

How to write inline JavaScript code in a Power Automate Flow

List All Stored Procedures in MS SQL Server