July 19, 2007 at 8:31 am
Hi All,
I need to place a wilecard % either side of an input parameter within the body of a stored procedure to use in the where clause.
What is the best way to do this?
Thanks
July 19, 2007 at 8:36 am
If you mean for working with LIKE, then ...
SET @ParameterName = '%' + @ParameterName + '%'
July 19, 2007 at 8:56 am
July 19, 2007 at 9:10 am
Keep in mind that if the SomeColumnName LIKE '%' + @ParameterName + '%' is the only criteria in your where clause, this will result in a table scan.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply