Thursday, November 18, 2010

Check comma separated values exist within the column having comma separated data

If you want to select records from table which having match some text in comma sperated list given by user with the values within the column of table having also data in comma seperated manner you can do query over table like below.


Select * from Table1
WHERE          exists(select val from Split([Column1],',') where val in (select val from Split(@CommaSeperatedList,',') ))

No comments:

Post a Comment