1

What options are available in SQL 2005 to pass in multiple values to store procedures

Psuedo codes

In C# code

    List<string> myApplicationList;
    .... (code to assign values)
    **Construct parameter list**
    Call stored procedure [spSelectMaster] with myApplicationList

SQL stored procedure

    CREATE PROCEDURE [Ecn].[spSelectMaster]
        **Need to declare parameter here but not sure what this would be**
    AS
    BEGIN
        SET NOCOUNT ON
        SELECT *
        FROM [dbo].[Master]
        WHERE [Master].[ApplicationKey] IN (@ApplicationList)
    END
    GO

Thanks in advance

JHA
  • 213
  • 1
  • 2
  • 11

1 Answers1

4

There is no built-in support for arrays in SQL Server 2005 T-SQL, but you can work around this:

Arrays and Lists in SQL Server 2005

How to pass a list of values or array to SQL Server stored procedure?

Mitch Wheat
  • 295,962
  • 43
  • 465
  • 541