Home Forums SQL Server 2008 T-SQL (SS2K8) Returning stored procedure results into a CTE or temp table? RE: Returning stored procedure results into a CTE or temp table?

  • cmerrell (8/21/2013)


    But "insert into" will only insert into an existing table. What about creating a new table?

    CREATE TABLE ...

    INSERT INTO

    EXEC ...

    Caveat is that you have to know the structure of the result set, but to be honest if you have a procedure that's non-deterministic in terms of the result set it's returning, there's probably something deeper that needs fixing/changing

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass