In SQL Server, I need to find a column for multiple values, but I don't have exact values, so I also need to use wildcards.
My current request looks like this:
SELECT * FROM table WHERE fieldname in ( '%abc1234%', '%cde456%', '%efg8976%')
This does not return any results, and yet, if I search for any one value, I find it, so I know that they are there. If you don't do a few ORs that are a bit cumbersome with a few hundred values, is there any way to do this?
I would also be interested to know why this query does not work, since the same query without% works just fine (except for a small problem only for finding a few exact matches).
source share