select * from tb1 where charindex('aaa',UName)>0

解决方案 »

  1.   

    倒是是'aa'aaa'aaaa'ddd' 还是aaa,aaaa,aa,ddd?...select case when charindex(',aaa,',','+uname+',')>0 then '存在' else '不存在' end
    from tb
      

  2.   

    数据是这种的话'aa'aaa'aaaa'ddd' charindex('‘’aaa‘’',uname)>0在aaa前面加上单引号进行精确查询
      

  3.   

    select *,(case when charindex('''aaa''',UName) then '存在' else '不存在' end)状态 from 表名
      

  4.   

    --sorry少了>0
    select *,(case when charindex('''aaa''',UName)>0 then '存在' else '不存在' end)状态 from 表名