Dynamic Like Statement in SQL

Posted by Peter McElhinney on Stack Overflow See other posts from Stack Overflow or by Peter McElhinney
Published on 2011-01-06T06:13:00Z Indexed on 2011/01/06 7:53 UTC
Read the original article Hit count: 258

Filed under:
|

Hey there!

I've been racking my brain on how to do this for a while, and i know that some genius on this site will have the answer. Basically i'm trying to do this:

SELECT column 
FROM table 
WHERE [table][column] LIKE string1 OR [table][column] LIKE string2 OR [table][column] LIKE string3...

for a list of search strings stored in a column of a table. Obviously I can't do a like statement for each string by hand because i want the table to be dynamic.

Any suggestions would be great. :D

EDIT:

I'm using MSSQL :(

© Stack Overflow or respective owner

Related posts about sql

Related posts about like-operator