How do I get structure of temp table then delete temp table. Is there a sp_helptext for temp tables? Finally is it possible to then delete temp table in same session or query window?
Example:
select *
into #myTempTable -- creates a new temp table
from tMyTable -- some table in your database
tempdb..sp_help #myTempTable
You need to use quotes around the temp table name and you can delete the temp table directly after using drop table ...
.
select *
into #myTempTable -- creates a new temp table
from tMyTable -- some table in your database
exec tempdb..sp_help '#myTempTable'
drop table #myTempTable