I have a table in which there is a column containing a row of comma separated values ββ(CSV).
eg. VALUE1, VALUE2, VALUE3
Passing as a filter is a different set of CSVs.
eg. VALUE2, VALUE3
So, in the above example, the query should return any records where any filter values ββare in the CSV column.
Example
declare @table table ( rownum int, csv nvarchar(300) ) insert into @table values (1,'VALUE1, VALUE2, VALUE3') insert into @table values (2,'VALUE1, VALUE2') insert into @table values (3,'VALUE1, VALUE3') insert into @table values (4,'VALUE3, VALUE4') insert into @table values (5,'VALUE1, VALUE2, VALUE3') insert into @table values (6,'VALUE3, VALUE4, VALUE2') insert into @table values (7,'VALUE3') declare @Filter nvarchar(50) set @Filter = 'VALUE1,VALUE2' select * from @table
So, in the above example, rows 1, 2, 3, 5, and 6 should be returned by the query, since they all contain VALUE1 or VALUE2.