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)
 Dynamically Assigning Variables to SP's

Author  Topic 

WalkerDA
Yak Posting Veteran

61 Posts

Posted - 2004-07-20 : 19:35:26
How can I write a stored procedure with varying parameters? Are is it even possible? I've done this before by defining variables and defaulting them to NULL..doesn't seem like a good way of accomplishing it this time since there can be up to 48 or as few as 1. Any takers?

Derrick

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2004-07-20 : 19:43:54
Ouch - that doesn't sound very nice.

Even if you managed to pull this off, it would not be very efficient because SQL likes strongly typed data.

What are you trying to accomplish? Maybe someone can offer you a better solution...

Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2004-07-20 : 19:53:13
Does this help:

http://vyaskn.tripod.com/passing_arrays_to_stored_procedures.htm

- Jeff
Go to Top of Page

WalkerDA
Yak Posting Veteran

61 Posts

Posted - 2004-07-20 : 20:09:42
Good article..The process has to happen as such: User gets a list of results, they select one result or many results, those results then get passed to a procedure, where currently it only supports one result or variable, the client needs it to accept multiple results. So a result could be one @comp, many @dates and one @reference_date. The @dates is where the problem is. I need to do some work on each row based on @dates. Maybe Timmy's article may work. I'm leaving for the night so if you think of something let me know cuz right now I'm stomped!

Derrick
Go to Top of Page
   

- Advertisement -