Select * from 表 Where charindex('%,5,%',','+ChannelId+',')>0
--搞错,应该是 Select * from 表 Where charindex(',5,',','+ChannelId+',')>0 --或者: Select * from 表 Where patindex('%,5,%',','+ChannelId+',')>0--或者: Select * from 表 Where ','+ChannelId+',' like '%,5,%'
楼主是要判断参数5是否在ChannelId中吗??Select * from 表 Where charindex('%,5,%',ChannelId)+charindex('5,%',ChannelId)+
charindex(',%5',ChannelId)>0
'%,5,%' 确实是这么用的么.我试了一下好像不行.
Select * from 表 Where charindex(',5,',','+ChannelId+',')>0
--或者:
Select * from 表 Where patindex('%,5,%',','+ChannelId+',')>0--或者:
Select * from 表 Where ','+ChannelId+',' like '%,5,%'
谢谢