How to pass collections to SQL stored procedures

added by Paul Wheeler
7/17/2014 2:49:35 PM

3 Kicks, 115 Views

MS SQL server doesn’t support arrays or other collection data types, so we can’t directly send in these types as parameters to stored procedures from client applications. But fortunately, SQL does allow us to send in DataTable objects in MS SQL Server 2008 and later. The solution here is to simply convert our collection types into a DataTable object and then pass the DataTable into the stored procedure. This should work for any type that you can restructure into a table format.


0 comments