开发者

Single quotes problem in SQL Server 2008

开发者 https://www.devze.com 2023-01-29 16:32 出处:网络
How this below insert query can be modified or escape single quote in SQL Server: INSERT INTO <tblname> (title,desc)

How this below insert query can be modified or escape single quote in SQL Server:

INSERT INTO <tblname> (title,desc)
VALUES
('Hen's Body','It's just best combination')

This query not run 开发者_StackOverflow中文版in SQL Server. I need similer solution to MySQL (like using backslash)as it is

INSERT INTO <tblname> (title,desc)
VALUES('Hen\'s Body','It\'s just best combination')

Regards


Double up the single quotes to escape them:

INSERT INTO ( title, description ) 
VALUES ( 'Hen''s Body', 'It''s just best combination' )
0

精彩评论

暂无评论...
验证码 换一张
取 消