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)
 Pass a variable number of values to a stored proc

Author  Topic 

maloy
Starting Member

19 Posts

Posted - 2002-11-06 : 12:55:37
Hi folks,
How can I pass a variable number of values as input/output parameters to a stored procedure?
While it is possible to work around this by passing a variable as the # of params and a delimited string with the params which can be parsed within the proc, I am looking for something similar to ParamArray used in VB.
Tia
Maloy

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-11-06 : 13:02:16
Stored Procedure parameters are defined at compile time, so the answer is: you can't ...

The CSV string is a decent idea that offers a lot of flexibility.

You could also define all the params you could possibly need and make them options.

Or you could put you mess of values into a table and select from the table in your proc.

Jay White
{0}
Go to Top of Page

maloy
Starting Member

19 Posts

Posted - 2002-11-06 : 13:09:57
I believe something like this is possible in Sybase sql server 12.5
Not sure if MS (still) has anything quite like it.
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-11-06 : 13:40:39
I'm curious...what doesn't work about the CSV technique? I use it all the time and it works like a charm. Parsing them out is no problem.

Go to Top of Page
   

- Advertisement -