Jr. A developer asked me the other day how to escape single quote? I find this question very interesting.
User can escape single quote using two single quotes (NOT double quote).
Following T-SQL Script will give error
WHERE City = ‘Villeneuve-d’Ascq’
Error: 105 Unclosed quotation mark after the character string ‘
To fix the error mentioned above, escape single quotes with two single quotes as displayed in following example.
USE AdventureWorks GO SELECT * FROM Person.Address WHERE City = 'Villeneuve-d''Ascq' GO
Well, it is a pretty easy way to escape single quotes. Here are a few interesting quotes about single and double quotes. In fiction, at least with American English (AmE), there’s really no use for single quotation marks other than as a quote within another quote. In general, quotation marks are used to mark direct speech in a text, to indicate irony, or to highlight the title of works that are part of a larger whole — like chapters of a novel, an article in a magazine or newspaper.
Let me know what you think of this blog post by leaving your opinion in the comment sections.
Reference: Pinal Dave (https://blog.sqlauthority.com)