How can one iterate over stored procedure results from within another stored procedure…without cursors?

前端 未结 7 1859
半阙折子戏
半阙折子戏 2020-12-19 07:06

I\'m not sure if this is something I should do in T-SQL or not, and I\'m pretty sure using the word \'iterate\' was wrong in this context, since you should never iterate any

7条回答
  •  情话喂你
    2020-12-19 07:48

    If you upgrade to SQL 2008 then you can pass table parameters I believe. Otherwise, you're stuck with a global temporary table or creating a permanent table that includes a column for some sort of process ID to identify which call to the stored procedure is relevant.

    How much room do you have in changing the stored procedure that generates the IDs? You could add code in there to handle it or have a parameter that lets you optionally flag the rows when it is called.

提交回复
热议问题