2012-05-30 102 views
-2

请参阅下面的查询。单和双引号问题插入

INSERT INTO pro VALUES ("260915",'Peel and Stick Floral Wall Art','Transform your tot's bedroom into a bright, burgeoning meadow with this set of oh-so-colorful wall art. Each unique flower, bird, butterfly, and swirly sun is a colorful creation of multilayered vinyl brimming with life and energy. How best to arrange them is entirely up to you--and your 12.2" x 15.4"','','Shipping',"790","110-m4jlgu36n",1.00,0,0,"0.00","70.00","http://.com/peel-and-stick-floral-wall-art.html","622") 

在这里,我有相同的值,单引号和双引号,我想在要插入列:

eg a) 12.2" x 15.4" 
    b) Transform your tot's 

请提出最佳的解决方案。

回答

2

在构建INSERT,在外面和问题,用单引号用双引号解决。

要使用单引号解决这个问题,通过更换'''

0

你为什么不逃你的报价? 12.2\"

+0

我不能,因为它是从服务器快到了,我需要插入数据库 –

+0

相同的,如果它是来自服务器,那么你不需要担心他们是吗? –

0

单引号'

'12.2" x 15.4"<br>' 

内把一切都像这样Transform your tot's串,你将不得不逃避它像

'Transform your tot\'s' 
0

对于T-SQL,让您的数据单引号,你只是另一个转义(例如使用两个单引号相邻)你并不需要担心的字符串常量内双引号。

INSERT INTO foo VALUES ('qwerty''s: 25" sq.') 
0

只使用单引号(')来包围这些值。如果单引号是该值的一部分,请输入两次(即将其转义)。

E.g.

INSERT INTO TABLE VALUES ('12.2" x 15.4"', 'Transform your tot''s bedroom...');