If I create a temporary table using the # sign:
SELECT * INTO #temp FROM dbo.table
Where is this table located? I can not find this from tempdb.
These tables created in tempDB , but the table name may not be the same as you defined.
tempDB
In my case, I get:
#temp______________________________000000000003
Try the following:
SELECT * INTO #temp FROM dbo.table SELECT * FROM tempdb.sys.tables
You should see a record for the temporary table that you just created ....
When you declare a temporary table, SQL Sever adds some extra characters to its name to provide a unique system name for it, and then stores it in tempDB in the sysobjects table. Even if you can query a temporary table with its logical name, the exact name that SQL Server has set is internally known.
How do you look for them? If you make a choice, you will receive data. But the table is available only in the session, only for the user who created it (you can have global temp tables).
They are stored in temp db.
Local temp tables can be created using the hash (#) sign before the table name.
They are visible only in the current connection. When a connection is terminated, its area also ends.
You can create and use a local tempo table with the same name simultaneously in two different connections.
More details
http://sqlnetcode.blogspot.com/2011/11/there-is-already-object-named-temp-in.html