sql server 2005 – SQL Multiple Parameter Values – Education Career Blog

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

,

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?

Leave a Comment