Home Forums SQL Server 2008 T-SQL (SS2K8) Outputting Sproc result set to a new physical table RE: Outputting Sproc result set to a new physical table

  • Eirikur Eiriksson (8/4/2015)


    sgmunson (8/4/2015)


    Eirikur Eiriksson (8/4/2015)


    sgmunson (8/4/2015)


    Eirikur Eiriksson (8/3/2015)


    Quick suggestion, use sys.dm_exec_describe_first_result_set or sys.dm_exec_describe_first_result_set_for_object, to get the structure of the output of the stored procedure.

    😎

    According to MS doc, that applies only to SQL 2014 and above, and this post is in a 2008R2 forum... unless it's "undocumented" in the earlier version ?

    My bad, the procedure sp_describe_first_result_set was introduced on 2012, along with the the dms. On 2005 and later one can use FMTONLY

    😎

    Okay, but FMTONLY requires a tool other than SSMS if you want to derive a CREATE TABLE statement from what you get back, which is just an empty recordset. With the dmv, you get a table back that can be used to derive a CREATE TABLE statement, fairly easily.

    Not really, just grab the execution plan and read it from there

    😎

    Not exactly an automatic solution, though.

    --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)