UNION the results of multiple stored procedures

前端 未结 4 1576
难免孤独
难免孤独 2020-11-30 02:48

I have a stored procedure I need to call several different times passing in different paramaters each time. I would like to collect the results as a single dataset. Is somet

4条回答
  •  天命终不由人
    2020-11-30 03:39

    You can do all of that but think about what you are asking......

    You want to pass multiple parameters to the sp and have it produce the same format result set for the different params. So you are, in effect, making a loop and repeatedly calling the stored proc with scalar data.

    What you should do is rewrite the sp so that it can take sets of parameters and provide you with a combined result. Then you only do 1 set based operation.

    You can pass table variables into an sp in 2008 as long as you make your own type up first.

提交回复
热议问题