Today, when I was trying to insert a value to a table in SQL Server which had single quotes, I ended by getting the following error.
Unclosed quotation mark after the character string
The query looked like this
INSERT INTO COUNTRIES (NAME) VALUES (‘Test’s’)
How to escape a single quote in SQL Server?
To fix the above error, we can escape the single quotes by doubling or inserting two single quotes as shown in the below query
INSERT INTO COUNTRIES (NAME) VALUES (‘Test”s’)