SQL Where 字符串拼接
declare @s varchar(100) set @s='1,2,3' --法一: select * from tb where charindex(','+ltrim(id)+',',','+@s+',')>0 --法二: exec('select * from tb where id in ('+@s+')')
declare @s varchar(100) set @s='1,2,3' --法一: select * from tb where charindex(','+ltrim(id)+',',','+@s+',')>0 --法二: exec('select * from tb where id in ('+@s+')')