I have a column in a table with sample data as follows:
ServiceTypeIds
7,1
1,9
1
9
4
7
7
In my Where clause I use the following to search on it:
WHERE (@ServiceTypes IS NULL
OR CHARINDEX(','+CAST(SEP.ServiceTypeIDs as VARCHAR(255))+','
, ','+@ServiceTypes+',') > 0)))
If my param @ServieTypes equals '1,9', then I get results, but when it's @ServiceTypes = '1' or just '9', then I don't recieve anything back. I'm stuck and tried the above.