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 2005 Forums
 Transact-SQL (2005)
 Passing string parameter to SP

Author  Topic 

brianpark
Starting Member

6 Posts

Posted - 2007-03-26 : 09:37:31
Hi I am brian,
I am having a problem to pass a string parameter to Stored procedure.
I have a stored procedure that accept @newParma varchar(255) and inside of a stroed procedure using in in the query criteria as in
select user_name from User where user_name not in (@newParam)
If I assigne only one name in the parameter it works like @newParam = "'jack'" but if I pass more than one like @newParam = "'jack', 'jane'" then the stored procedure recognize entire string as one name therefore it does not reutrn anything. Anybody hany any though on this?

Thanks in advnace.
Brian.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-03-26 : 09:42:52
make use of CSVTable from http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=25830&SearchTerms=CSVTable

select user_name
from User u
where u.user_name not exists (select stringval from CSVTable(@newParma))



KH

Go to Top of Page

brianpark
Starting Member

6 Posts

Posted - 2007-03-26 : 10:37:25
Thanks khtan,
It works great.
Go to Top of Page
   

- Advertisement -