SQL 中的转义字符 [英] Escape Character in SQL

查看:36
本文介绍了SQL 中的转义字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请原谅我是一个 sql 菜鸟.我正在尝试使用以下内容进行插入,但撇号有问题.我有很多记录要插入,但很多都有同样的问题.有没有办法摆脱它们?

Please forgive me as I am a bit of an sql noob. I am trying to do an insert using the following but am having a problem with the apostrophes. I have a lots of records to insert but many have the same problem. Is there a way of escaping them?

INSERT INTO  [dbo].[tb_Chefs] ([ChefHotelID], [HotelID], [ChefID],   
     [Position],  [GroupID])  
VALUES(N'b809a86e-f7f2-45b2-a240-0049f51509d7' ,N'14481', N'624', 
     N'Chef d'atelier', N'331')
GO

非常感谢任何帮助.

推荐答案

'Chef d'atelier' 变成 'Chef d''atelier'

只需将它们加倍

如果一个字符串包含在单引号包含一个内嵌引号,代表内嵌单引号两个单引号.

If a character string enclosed in single quotation marks contains an embedded quotation mark, represent the embedded single quotation mark with two single quotation marks.

这篇关于SQL 中的转义字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆