Is it possible to send a collection of ID’s as a ADO.NET SQL parameter?

Generally the way that you do this is to pass in a comma-separated list of values, and within your stored procedure, parse the list out and insert it into a temp table, which you can then use for joins. As of Sql Server 2005, this is standard practice for dealing with parameters that need to hold arrays.

Here’s a good article on various ways to deal with this problem:

Passing a list/array to an SQL Server stored procedure

But for Sql Server 2008, we finally get to pass table variables into procedures, by first defining the table as a custom type.

There is a good description of this (and more 2008 features) in this article:

Introduction to New T-SQL Programmability Features in SQL Server 2008

Leave a Comment