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)
 SP Help

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-06-14 : 07:18:04
Ratan writes "Dear Sir/Madam,

I would be very thankful if you can help me how to approach the problem.

I kind of like this example set by you.
"CREATE PROCEDURE usp_finduser

@usr_id int
AS

SELECT * FROM USERLIST
WHERE usr_id=@usr_id

Execute Statement:
exec usp_finduser '1'
"

But my problem is something along the lines of one of the multiple paramaters can be passed to the SP and obtain results.

Like
"
CREATE PROCEDURE usp_finduser
@usr_id int
@usr123_id int
@usr456_id int

AS
SELECT * FROM USERLIST
WHERE usr_id=@usr_id

Else
SELECT * FROM USERLIST
WHERE usr123_id=@usr123_id

Else
SELECT * FROM USERLIST
WHERE usr456_id=@usr456_id

"
Please help!
Thanks
Ratan"

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-06-14 : 07:56:46
If you are wanting to pass multiple users to the SP, you should search for parsing comma-delimited lists on this forum. It sounds like that's what you want to do.

EXEC usp_finduser '1234,14142,123445'

Is that correct?

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page
   

- Advertisement -