首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

多次模糊查询有没有什么好方法?解决方案

2012-04-06 
多次模糊查询有没有什么好方法?想在一列中查找包含字符‘’,‘#’,‘%’,‘(’,‘)’……的结果有没有什么好方法?[解决

多次模糊查询有没有什么好方法?
想在一列中查找包含字符‘·’,‘#’,‘%’,‘(’,‘)’……的结果有没有什么好方法?


[解决办法]

SQL code
create table test1(strA varchar(100))insert into test1 select 'abc·defghig' union allselect '12345%67'select * from test1 where CHARINDEX ('·',strA)>0 or CHARINDEX ('%',strA)>0  or CHARINDEX ('(',strA)>0  or CHARINDEX (')',strA)>0
[解决办法]
SQL code
create table a(b varchar(100)) insert into a select 'qeturojt'select'123%34358' union allselect'1233435#8' union allselect'1(3%34358' union all select'1.3#43)8'select * from a where b like '%.%' or b like '%#%' or CHARINDEX('%',b)>0 or b like '%(%' or b like '%)%' drop table a 

热点排行