SQL Server Performance

Determining if a column exists in a temp table

Discussion in 'General DBA Questions' started by stangman, Nov 13, 2002.

  1. stangman New Member

    I have a temp table where I need to determine if a column already exists in the temp table. I have looked at sp_column with passing the parameters @table_name and @column_name and then testing @@row_count. This works great for a permanent table, but will not work for a temp table.

    Does anyone know how this can be done?

  2. satya Moderator

    Keep in mind once you're completed with session temp tables will be dissappeared, so its not possible to keep a track on them. Its better to query against syscolumns under temp database for an information.


    Satya SKJ

Share This Page