Question : temporary table structure

I need to find the table structure for a local temporary table.

create table #test (
a int,
b int
)

sp_columns #test

doesn't work.

If it's possible I want to use some an existing stored procedure (such as sp_columns)
and avoid the searching in sistem databases, tables ....

Answer : temporary table structure

The only way I can think of to do it is to do a

SELECT * INTO ##schematesttable FROM #mytemptable WHERE 1=0

thus taking a "schema copy" into table name that you can identify.

but this wont work concurrently unless you seed the ##schematesttable table name.

but ar Richard says there is no "simple solution".  in 99.9% of cases when a temp table is created the schema should be known.
Random Solutions  
 
programming4us programming4us