Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Using LIKE With Parameters In Stored Procedures

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-08-29 : 07:27:11
Jason writes "I'm having a difficult time with using the LIKE command in a stored procedure. The idea is to use a stored procedure rather than Dynamic SQL for a search. For example:

ITEMS
ItemID
ItemName
ItemKeywords

SELECT ItemID
FROM Items
WHERE ItemKeywords LIKE '%@SearchTerm%'

However, this doesn't work the way I want it to. Can you help me out on this one? I searched your articles, but couldn't find a solution to this particular challenge."

LarsG
Constraint Violating Yak Guru

284 Posts

Posted - 2005-08-29 : 07:39:53
[code]
SELECT ItemID
FROM Items
WHERE ItemKeywords LIKE '%' + @SearchTerm + '%'
[/code]
Go to Top of Page
   

- Advertisement -