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
 Transact-SQL (2000)
 Argument Count to an SP

Author  Topic 

ourspt
Starting Member

33 Posts

Posted - 2005-12-28 : 06:02:50
Hi,

Is there a way, where I could pass an array or something like that as an input to an SP.

In other words, I want the SP to be able to accept a variable number of parameters and work with them. For example, it should accept 6 parameters if I give 6 and 10 if I give 10. The data type of all the parameters would be same.

Thanks
ourspt

shallu1_gupta
Constraint Violating Yak Guru

394 Posts

Posted - 2005-12-28 : 06:18:15
Arraya are not there in SQL.However you can pass a comma delimited string as a parameter in an sp and can convert the csv string into a table type variable or temp table which will give u same functionality as of an array.
go thru this link..
http://www.sqlteam.com/item.asp?ItemID=637
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2005-12-28 : 10:03:13
Read up on csv COMMA DELIMITED STRINGS as Shallu1 said
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-12-29 : 01:28:54
If not, post additional informations like sample data and expected result

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -