I would like to pass a comma separated string or similar (whatever is best) to a stored procedure and have it apply each value to a LIKE condition in a query.
For example if I pass @terms = "avenue,park,road" to the stored procedure it would then generate a query along the lines of:
SELECT *
FROM properties
WHERE
properties.Address LIKE @terms[0] OR
properties.Address LIKE @terms[1] OR
properties.Address LIKE @terms[2]
It needs to work with SQL server 2008. Can anyone advise me of the best approach? Thanks.