New answers tagged temp-tables
Let's start with the query in Paul White's blog post, Viewing Another Session’s Temporary Table (linked provided by @PJMahoney in a comment on the Question), as that gives us a few key pieces of information. Please note that I have added two fields to Paul's original query to handle the translation of the hex/binary value in the first_page field. SELECT ...
For table variables there is not much you can do. However, for temporary tables (even local ones -- i.e. those with names starting with a single #) there is quite a bit that can be done. With regards to the behavior of local temporary tables not surviving the end of the process in which they were created, the place where people seem to get stuck is in ...
For SQL Server 2012 and later you can use sys.dm_exec_describe_first_result_set to get the table definition of a query.
If you really really need to make your life very difficult down the road, you may be able to create something like the following code. It creates a temporary table, inserts the top(10) rows into it from the source table, then outputs those rows from the temporary table. The temporary table is created with all columns set to allow 'NULL' values. Create the ...
Top 50 recent answers are included