为参数传递的多个参数不起作用

时间:2019-01-29 08:09:34

标签: sql-server tsql

Create Proc ABC
Declare @Var1 VARCHAR (MAX)
Declare @Var2 Int
As BEGIN 

Update Table Set Column = @Var1 where Column1 in (@Var2)

End
EXEC  ABC @Var1 = 'ABCD', 'ABCDE' @Var2= 14

传递给Varibale @Var1的多个参数不起作用

2 个答案:

答案 0 :(得分:0)

执行以下操作:

EXEC ABC @Var1 = 'ABCD, ABCDE' @Var2= 14

答案 1 :(得分:0)

您必须使参数值像带有逗号分隔值的列表一样。

Create Proc ABC
Declare @Var1 VARCHAR (MAX)
Declare @Var2 Int
As BEGIN 

Update Table Set Column = @Var1 where Column1 in (@Var2)

End
EXEC  ABC @Var1 = '''ABCD'', ''ABCDE''' @Var2= 14

喜欢-

EXEC  ABC @Var1 = '''ABCD'', ''ABCDE''' @Var2= 14