【发布时间】:2014-10-30 19:38:13
【问题描述】:
我正在查询从像
这样的表中获取值Select email from cust Where name = " John carter's "
由于字符串中的单引号导致我收到错误......
请帮我解决上述问题
【问题讨论】:
我正在查询从像
这样的表中获取值Select email from cust Where name = " John carter's "
由于字符串中的单引号导致我收到错误......
请帮我解决上述问题
【问题讨论】:
这应该可行:
Select email from cust Where name = " John carter''s"
【讨论】:
',如下所示:Select email from cust Where name = " John carter''s''"
如果这是你现在需要得到的东西......
Select email from cust Where name LIKE "%John carter%"
或者你可以省略撇号:
Select email from cust Where name = " John carter''s"
【讨论】:
为什么不用转义字符?
这样
Select email from cust Where name = " John carter''s "
【讨论】:
您遇到的问题是由于(取决于您使用的数据库程序)单引号 ' 是 SQL 数据建模语言 (DML) 分隔符,因此 SQL 解析器可能不会能够妥善处理。
【讨论】: