How do I escape a single quote in SQL Server?

前端 未结 13 1845
情话喂你
情话喂你 2020-11-21 07:01

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?

13条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-21 07:42

    The following syntax will escape you ONLY ONE quotation mark:

    SELECT ''''
    

    The result will be a single quote. Might be very helpful for creating dynamic SQL :).

提交回复
热议问题