Save multiple resultsets from stored procedure into temp objects

  • Is there any way to store multiple resultsets returing from one stored procedure into temporary objects?

    Lets say there is a stored procedure SP1 which returns two resultsets - one resultset has 2 columns and second resultset has only 1 column.

    Then call the stored procedure SP1 within another stored procedure SP2. And want to save resultsets of SP1 into temporary table within SP2.

    Thanks in advance!!!!

  • No, I think you'd need to rewrite SP1 so that it only returns one result set, then write another stored procedure to return the second result set.

    John

    [Edit - rewrote reply after re-reading the original question]

  • In my case the stored procedure SP1 is returning two resultsets say resultset1 (has 2 columns of int type) and resultset2 (has only one column of varchar type).

    What I want is I am calling the SP1 from another stored procedure SP2 and want to save the resultset2 into temporary table.

  • may be it is possible through returing multiple results in one single xml and again seperating the xml to different set of tables 🙂

    Regards, Yog

  • For this need to change the existing stored procedure.

    Anyways can you please give some sample code?

  • I prefer the one where you have a go at writing it yourself, and post back with what you've tried if you run into any particular problems.

    John

  • any updates????

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply