How to use result set returned by Stored Procedures?

  • I had seen the:

    CREATE TABLE #tmp (...)

    INSERT #tmp (...)

    EXEC @err = some_sp @par1, @par2 ...

    approach for processing stored procedure result set but this method has a limitation when it is used by nested SPs.

    I wish to know if there is another approach to solve this problem.

    Regard,

    john

  • Create the temp table at a higher level in the nest.  Or, use a global ##temp table (only one named instance can live at a time).

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • You can also use "Permanant" temp table thats build in your outer procedure and the inner procedure can populate/update it and the temp table isdeleted after its done using the results.

    Thanks

    Sreejith

Viewing 3 posts - 1 through 2 (of 2 total)

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