How MS Outlook Broke a SQL Query

Steve Sohcot
2 min readJan 17, 2022

--

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!

--

--

No responses yet