当前位置: 代码迷 >> Sql Server >> 多次模糊查询有没有什么好方法?解决方案
  详细解决方案

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

热度:44   发布时间:2016-04-27 13:38:59.0
多次模糊查询有没有什么好方法?
想在一列中查找包含字符‘·’,‘#’,‘%’,‘(’,‘)’……的结果有没有什么好方法?


------解决方案--------------------
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
  相关解决方案