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)
to mengzulin(Julian) paoluo的是对的, 你的Select * from TableName Where CharIndex('14,',AA)>0有问题 如果是114,214之类的也会被查出来,是不是?
Select * from TableName Where CharIndex(',14,',','+AA)>0Select * from TableName Where ','+AA Like '%,14,%'
Select * from TableName Where CharIndex('14,',AA)>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)
paoluo的是对的,
你的Select * from TableName Where CharIndex('14,',AA)>0有问题
如果是114,214之类的也会被查出来,是不是?