Someone in the forums asked about the internal storage of the temporary table. The questioner was complaining that the table was not stored in the database
Let us consider this example
create table #t(i int)
Now check the existance of the table in information_schema.tables view
select * from tempdb.information_schema.tables
where table_name='#t'
The above query does not return any informations about the table #t. Now execute sp_help and see what happens
exec tempdb..sp_help '#t'
It returns multiple resultsets. The first resultset contains the table name. If you see the table name it is as follows
#t__________________________________________________________
________________________________________________________000000000030
SQL server appends lot of underscores and some id as part of the temporary table name. Do you know why this is happening?. Ok. Now open another query analyser and run this code.
create table #t(i int)
Now execute sp_help and see what happens
#t__________________________________________________________
________________________________________________________000000000033
So from the above examples it is clear that the actual name is stored differently. It is because that anyone can create temporary table with the same table name and in order to avoid any conflict on the table name, SQL Server stores the name in a unique way. So if you want to know the structure of the temporary table always make use of sp_help system stored procedure that runs on the tempdb database.