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

后端 未结 4 1423
情话喂你
情话喂你 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:17

    I tried Ant's approach and it worked a treat:

    Declare @Success tinyint
    Declare @Response Table (Success int)
    Insert into @Response(Success)
    Exec Fix_RollbackReturn 12345, 15
    Select @Success=Success from @Response
    

    As you can see I used a Table Variable rather than a temporary table because slightly more efficient than a temporary table.

    Thanks for all your help guys.

    EDIT: It appears that Dave was right after all. That is, my Exec-into-Table-variable approach worked on my SQL2005 development machine, but when moved to the Live (SQL2000) machine it objected, so I had to change to the temporary table approach.

    It's a little annoying, especially since in a couple of weeks we are upgrading to SQL2005 across the board(!).

提交回复
热议问题