Question

Is there an easy way to select the data from another session's temp table? I need to do so ad-hocly to debug an issue that I have limited visibility on otherwise. E.g. if I have access to TEMPDB, is it possible to access the table object itself?

I saw this post from Paul White on one way to do it, but it's a lot more involved then I was hoping for: Viewing Another Session's Temporary Table

I cannot switch the code to use a global temp table for debugging purposes.

Was it helpful?

Solution

#temp is session scope

CREATE TABLE (Transact-SQL) - Temporary Tables

A local temporary table, #table_name, exists only for the duration of a user session or the procedure that created the temporary table.

Do the official microsoft way no tricks, it would end in a mess

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top