MSSQL Escape Character

February 25th, 2009

Here is something that got me for a while today, escaping characters in MsSQL. I went through and tried the normal \ then thought I was losing it and tried the other slash /. However for some odd reason Microsoft went with the single tick ‘.

So for example a mssql query using the escape character might look like

SELECT a FROM b WHERE a = 'cory''s'

Notice the double tick to escape the apostrophe. Really quite simple but still really weird.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>