In a Micrososft SQL Server table I have a column with a string.
I also have a dynamic list of substrings
('icouldnt', 'stuff', 'banana')
I don't care for string manipulation. The substrings could also be called:
('%icouldnt%', '%stuff%', '%banana%')
What's the best way to find all rows where the string contains one of the substrings?
Solutions that are not possible:
- multiple OR Statements in the WHERE clause, the list is dynamic
- external Code to do a "for each", its a multi value parameter from the reportbuilder, so nothing useful here
- changing the database, its the database of a tool a costumer is using and we can't change it, even if we would like... so much
I really cant believe how hard such a simple problem can turn out. It would need a "LIKE IN" command to do it in a way that looks ok. Right now I cant think of anything but a messy temp table.