SQL Server 2008 and ADO.NET: Passing Collections as a parameter to stored procedure [Using TVP]

You can pass collections as Stored procedure parameter in SQL Server 2008. This is very useful in many scenarios.

Following are few options to send:

1. Easiest option is to send DataTable that has same column names as UDT in database

2. With little bit of extra code any custom collections can be passed as TVP [by popluating meta-data and SqlDataRecord collection].

Please see this excellent article for more details: http://www.sommarskog.se/arrays-in-sql-2008.html

Leave a Reply