Answered by:
Store Procedure with ArrayList as Parameter

Question
-
Dear All,
I've problem to passing parameter to store procedure, the problem is parameter that i want passing is an ArratList.
i want store procedure insert to database with array that i passing.
It's that possible and how i can do that ?
Thank you for your help.
Best regards,
Surbakti
Wednesday, October 23, 2013 8:46 AM
Answers
-
ARRAYLIST concept is not available in SQL Server.
You may look at Table Value Parameter(TVP) to acheive the same.
It would be great if you can go through the below link too:
http://www.sommarskog.se/arrays-in-sql-2008.html
Please use Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful.
- Proposed as answer by Stefan Hoffmann Wednesday, October 23, 2013 9:34 AM
- Marked as answer by Allen Li - MSFT Thursday, October 31, 2013 2:45 AM
Wednesday, October 23, 2013 8:49 AM -
I think you may need to convert ArrayList to a DataTable and pass this DataTable to the Stored Procedure using SQLDbType.Structured
Convert ArrayList to DataTable in C#
Krishnakumar S
- Proposed as answer by HimanshuSharma Wednesday, October 23, 2013 10:03 AM
- Marked as answer by Allen Li - MSFT Thursday, October 31, 2013 2:45 AM
Wednesday, October 23, 2013 9:05 AM
All replies
-
ARRAYLIST concept is not available in SQL Server.
You may look at Table Value Parameter(TVP) to acheive the same.
It would be great if you can go through the below link too:
http://www.sommarskog.se/arrays-in-sql-2008.html
Please use Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful.
- Proposed as answer by Stefan Hoffmann Wednesday, October 23, 2013 9:34 AM
- Marked as answer by Allen Li - MSFT Thursday, October 31, 2013 2:45 AM
Wednesday, October 23, 2013 8:49 AM -
Hi,
Try to use a table valued paramters
This link will help you : http://vinay.inkeysolutions.com/2011/03/table-valued-parameters-in-sql-server.html
Best regards,
- Edited by KH MR Wednesday, October 23, 2013 8:57 AM
Wednesday, October 23, 2013 8:56 AM -
I think you may need to convert ArrayList to a DataTable and pass this DataTable to the Stored Procedure using SQLDbType.Structured
Convert ArrayList to DataTable in C#
Krishnakumar S
- Proposed as answer by HimanshuSharma Wednesday, October 23, 2013 10:03 AM
- Marked as answer by Allen Li - MSFT Thursday, October 31, 2013 2:45 AM
Wednesday, October 23, 2013 9:05 AM