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)
 Multiple id's passed to a stored proc

Author  Topic 

cykophysh
Starting Member

24 Posts

Posted - 2007-03-12 : 11:19:43
Hi Guys,
I need a hand with the following.

I need to write a stored proc that accepts a parameter that contain multiple values.
i.e

alter proc spGetLastNames
@Firstnames varchar(200)

as

Select lastname from user where firstname in(@Names)



@Firstnames should be able to accept a comma delimited string i.e 'Frank', 'Peter', 'William'



Kind Regards,
Gary

<A href="http://www.threenineconsulting.com" target="_blank" >My Website</a> || <a href="http://threenineconsulting.com/forum/blogs/cykophysh/default.aspx" targer="_blank">My Blog</a>

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-03-12 : 11:25:57
Check this link for the discussion of best split functions:

[url]http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=50648[/url]

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
   

- Advertisement -