When I've had to do the same thing, I just add this to the top of the proc:
declare @CSQList table (CSQID int)
while charindex(',',@CSQs) > 0
begin
insert into @CSQList (CSQID) values(left(@CSQs,charindex(',',@CSQs)-1))
set @CSQs = right(@CSQs,len(@CSQs)-charindex(',',@CSQs))
end
insert into @CSQList (CSQID) values(@CSQs)
And then:
where CSQ in (Select * from @CSQList)
Works a treat.
No comments:
Post a Comment