Stored procedure with variable number of parameters

后端 未结 6 1975
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-29 06:48

I have stored procedure where I have to pass parameters, But the problem is I am not sure how many parameters is going to come it can be 1, in next run it can be 5.

6条回答
  •  情话喂你
    2020-12-29 07:35

    SQLServer lets you pass TABLE parameter to the stored procedure. So you can define table type, CREATE TYPE LIST_OF_IDS AS TABLE (id int not null primary key), alter your procedure to accept a variable of this type (it should be readonly).

提交回复
热议问题