How do I escape a single quote in SQL Server?

前端 未结 13 1847
情话喂你
情话喂你 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:24

    The doubling up of the quote should have worked, so it's peculiar that it didn't work for you; however, an alternative is using double quote characters, instead of single ones, around the string. I.e.,

    insert into my_table values("hi, my name's tim.");

提交回复
热议问题