I am trying to make a parameter multiselect on a CSV column in a report, but I am not sure how to do this or if it's even possible. Example dataset that is returned:
| ID | Name | Types |
| 1 | Test | Type A, Type B |
The current dataset is using something like this in the WHERE
clause for the parameter:
WHERE Types LIKE '%' + @Types + '%'
This works fine as a single select, but of course doesn't work for multiselect. How can I make it so the parameter will allow multiple values and still search this CSV column? I wish something like WHERE Types LIKE IN '%' + @Types + '%'
would work, where it basically would end up as WHERE Types LIKE IN ('%Type A%, %Type B%')
. Or is there a better way I can display the column so it appears CSV even if the SQL is not doing it? I would still want it to display all the values and only see if the selected type is in the list, so if the parameter is set to Type B
it should still show Type A, Type B
for ID = 1
. I know CSVs are generally disliked in SQL, but it seems to be a frequent thing that's asked to make CSV columns and then allow multiselect on it.