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)
 Like in Stored proc. with parameter

Author  Topic 

farouche
Starting Member

1 Post

Posted - 2001-03-04 : 06:25:12
I have made a stored procedure, in which I want to find if a varchar is containing a string that is delivered to the procedure by a varchar parameter like this :

create Procedure sp_ListID
@name varchar(50)
As
SELECT DISTINCT user.id
From user
where user.name like '%@name%'


It won't find the right result since @name probably is seen as a string and not a variable.

If I do this it works just fine : where user.name like '%something%'

But is there a way to do it with the variable ??

Thanks in advance

   

- Advertisement -