Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

array stored procedures

Status
Not open for further replies.

shalinic

Programmer
Aug 4, 2003
2
IN
hi ,
i am working on stored procedures . I getting the data from a front end as an array . How can catch the same data in a stored procedure as input . Is array a datatype in stored procedures . Or any other data type , which i can use to catch the data in stored procedure .
 
hi

i think it is not possible to pass arrays to
stored procedures. What you may have to do is write a loop in your VB
that calls this stored procedure with the values.

Good Luck
Gopala Krishna Kakani

 
You can accept an array in an SP if you just pass it in as a delimited list separated by a comma (or whatever). Just declare your input parameter as varchar and you can loop through the array using T-SQL string functions from within the SP...


 
....And, you can leverage it, in your sp, like this....

SELECT T.*
FROM myTable T
INNER JOIN fn_Split('1,2,3,4,5,6', ',') AS Q
ON T.[ID] = Q.value
 
If you are using SS2K, you may be able to use the new table variable. It reflects somewhat the structure of a Temp table, without the overhead. Not sure on you exact needs, but it may work in this case

Thanks

J. Kusch
 
If you want to pass a list of values into a stored proc, have a look at this FAQ which gives the main methods:

Passing a list of values to a Stored Procedure
faq183-3979

--James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top