Calling a Stored Proc from within a Stored Proc and returning a recordset

后端 未结 4 1459
情话喂你
情话喂你 2021-01-22 21:31

I have a Stored Procedure that rolls-back a series of operations. I want to call this from within another SP.

The problem is that the inner SP returns a record set with

4条回答
  •  既然无缘
    2021-01-22 22:16

    A stored procedure returns a record set like any other, so you can actually do this:

    INSERT INTO MyTable ( MyValue )

    EXEC dbo.MyStoredProcedure

    The EXEC takes the place of a SELECT statement. To get the value, just SELECT from the table you inserted into. Typically, this would be a temp table.

提交回复
热议问题