declare @str varchar(20)set @str='1,2,3,4'select * from tbl where charindex(','+ltrim(a),','+@str)>0 [解决办法] where a in(1,2,3,4) and b='anything' and c=…… [解决办法]
[解决办法] 用in来实现嘛,相当于是要查的变量的集合 where ?? in(1,2,3) [解决办法] where a in( select a=1 union select 2 union select 3) and a not in( select a=4 union select 5 union select 6) and b.... and c....