Sunday, February 19, 2012

Array As parameters to procedure

Hi friends,
Please help me I want to pass an Aarry parameters from asp.net to sqlserver stored procedure. Is it possible, if yes how.

regards,
Asad Mahmood

Hi,

SQL Server doesn't seem to have any array-like parameter so what you can do is that create a CSV (comma separated values) out from your data and pass that to the procedure (which could take that as varchar(8000) etc depending on the needed length).

In the proc you could parse this CSV into say a temp table containing values as integers, if you use a function.Here is an example of such function.

|||It will be easier if you are using Arraylist but try this link for how to do it. Hope this helps.
http://www.sommarskog.se/arrays-in-sql.html

No comments:

Post a Comment