I am trying to view the execution plan for a stored procedure that contains a couple of temporary tables. Every time I try to view the plan, however, there is only one item in the plan with the message:
Invalid object name ‘#temp’.
If I switch the temporary tables to table variables, it appears to show the execution plan. Unfortunately, the stored procedure needs to use temporary tables, and I need to be able to measure the code changes in the execution plan. Does anyone happen to have any insight as to why I cannot view these plans or know of a way to be able to view them when the query contains temporary tables? For reference, I am using Toad for SQL Server against a SQL 2008 R2 server.