I\'m trying to insert
some text data into a table in SQL Server
9.
The text includes a single quote(\').
How do I escape that?
If escaping your single quote with another single quote isn't working for you (like it didn't for one of my recent REPLACE()
queries), you can use SET QUOTED_IDENTIFIER OFF
before your query, then SET QUOTED_IDENTIFIER ON
after your query.
For example
SET QUOTED_IDENTIFIER OFF;
UPDATE TABLE SET NAME = REPLACE(NAME, "'S", "S");
SET QUOTED_IDENTIFIER ON;
-- set OFF then ON again