UNION the results of multiple stored procedures

前端 未结 4 1572
难免孤独
难免孤独 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 use INSERT EXEC for this.

    declare @myRetTab table (somcolumn ...)
    insert @myRetTab
    exec StoredProcName @param1
    

    Then use union on the table variable or variables.

提交回复
热议问题