|
Back

Using LIKE with SQL Server Stored Procedures - Problems With The % Sign
Problem
You are passing a parameter @xxx to a stored procedure in SQL Server. The parameter is being used in the WHERE clause with LIKE qualifier. For example:
Select Title from Publishers WHERE Title LIKE '%@xxx%'
The query will not return a recordset.
Solution
My guess is that you want to use:
select title from publishers where title like '%' + @xxx + '%'
If that doesn't work, try '%' + ltrim(rtrim(@xxx)) + '%', but I don't think you'll need to.
Back
|