【问题标题】:SQL Multiple Parameter ValuesSQL 多参数值
【发布时间】:2009-03-29 20:08:04
【问题描述】:

SQL 2005 中有哪些选项可以将多个值传递给存储过程

伪代码

在 C# 代码中

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

SQL 存储过程

    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

提前致谢

【问题讨论】:

    标签: sql-server-2005 stored-procedures


    【解决方案1】:

    SQL Server 2005 T-SQL 中没有对数组的内置支持,但您可以解决这个问题:

    Arrays and Lists in SQL Server 2005

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

    【讨论】:

      猜你喜欢
      • 2021-11-10
      • 1970-01-01
      • 1970-01-01
      • 2018-06-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-15
      • 1970-01-01
      相关资源
      最近更新 更多