读书人

查询表中数据中带quot; #039; quot; 的有关问题

发布时间: 2012-08-10 12:19:33 作者: rapoo

查询表中数据中带" ' " 的问题
怎样查询数据中带“ ' "的数据

比如:类似 ABDE'dsd的数据

[解决办法]

SQL code
create table tb(code varchar(120))insert tb select 'ABDE''dsd' union select 'sfs' union select 'assfdf''sdf' select * from tb where CHARINDEX ('''',code)>0 /* codeABDE'dsdassfdf'sdf*/drop table tb
[解决办法]
探讨
table:
名称
ass'edds

select * from table where 名称='ass'edds'

类似这样的查询

[解决办法]
SQL code
select * from table_name where 名称 = 'ass''edds'   --需要转义一下,用2个'代表一个' 

读书人网 >SQL Server

热点推荐