Cannot view query execution plan because of "select into" temp table statement

  • Is there a way in SSMS to view the query plan for t-sql that includes a temp table created using "select * from source_table into #my_table" syntax? The code I'm working with fails to show the query plan with the error "invalid object name #my_table" because the temp table isn't explicitly defined in the code, but only as a result of the "select into".

  • What version and Service Pack? This should work.

    Try the following and it should work as an example.

    set showplan_xml on

    go

    select *

    Into #testtemp

    From sys.databases

    go

    set showplan_xml off

    go

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

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

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