Search code examples
sqlsql-servert-sqltemp-tables

Find the column names of Temp table


I need to find the column names of temp table.

If it is a physical table then we can either use sys.columns or Information_schema.columns system views to find the column names.

Similarly is there a way to find the column names present in temp table?


Solution

  • SELECT *
    FROM   tempdb.sys.columns
    WHERE  object_id = Object_id('tempdb..#sometemptable');