select * from tablename where charindex(',2,',','+type+',')>0

解决方案 »

  1.   

    select * from tablename where charindex(',2,',','+type+',')>0
      

  2.   

    没必要用in,可以以下方法:
    select * from tablename where type like '%2%'
    select * from tablename where charindex('2',type)>0
      

  3.   

    select * from tb1  where charindex(type,'2')=1
      

  4.   

    select * from tb1  where charindex(name1,'2')=1
      

  5.   

    select * from tablename where type in ('2','3','4','5')
      

  6.   

    select * from tablename where type like '%2%'
    select * from tablename where charindex('2',type)>0