TSQL: Call a stored procedure from another stored procedure and read the result

后端 未结 5 1665
自闭症患者
自闭症患者 2020-12-14 15:29

I have a stored procedure that, ending with a SELECT, returns a recordset. I can call it within anoher stored procedure like this:

EXEC procedure @param
         


        
5条回答
  •  没有蜡笔的小新
    2020-12-14 16:17

    First, you CANNOT RETURN a recordset by stored procedure. By return, a stored procedure can only return integers.

    You mentioned SELECT statement, which is a DQL and just for display purpose.

    The way you can do to work around this issue is that you can assign the recordset to a global temporary table which can also be accessed within the outer stored procedure.

提交回复
热议问题