select * from 表 where aa like '%14%'

解决方案 »

  1.   

    Select * from TableName Where CharIndex(',14,',','+AA+',')>0
      

  2.   

    Like可以这么写Select * from TableName Where ','+AA+',' Like '%,14,%'
      

  3.   

    如果最后有","号
    Select * from TableName Where CharIndex(',14,',','+AA)>0Select * from TableName Where ','+AA Like '%,14,%'
      

  4.   

    谢谢paoluo,不知道今天怎么回事,结不了贴。晕,回头结贴。
      

  5.   

    paoluo(一天到晚游泳的鱼) 的有一点点不对如果14在前面就无法找到了,应该改成:
    Select * from TableName Where CharIndex('14,',AA)>0
      

  6.   

    回复人: mengzulin(Julian) ( ) 信誉:100  2005-05-26 10:49:00  得分: 0  
     
     
       paoluo(一天到晚游泳的鱼) 的有一点点不对如果14在前面就无法找到了,应该改成:
    Select * from TableName Where CharIndex('14,',AA)>0  
    ----------------------------------------------------------------------------Select * from TableName Where CharIndex(',14,',','+AA)>0Select * from TableName Where ','+AA Like '%,14,%'14在最前面我的语句也可以查出来,不信你试试 Declare @S Varchar(100)
    Set @S='14,15,16,'
    Select CharIndex(',14,',','+@S)
      

  7.   

    to mengzulin(Julian)
    paoluo的是对的,
    你的Select * from TableName Where CharIndex('14,',AA)>0有问题
    如果是114,214之类的也会被查出来,是不是?