some duh help please

  • I have done some searching in the BOL looking for a way to check the existence of a table in TEMPDB.  No luck.

    I am looking to check the existence a table in the TEMPDB.  The table is called #TEMP_WORK.  I want to check if it is there before using a create table statement.

    I am running short of time, and don’t have my SQL books with me.  Can some help me out?

     

  • if not exists(select object_id('tempdb..#temp_work'))

      print 'create temp table'

    else

      print 'exists'

  • thank you for your help.  I just could not remember syntax for this.  Daylight saving time is taking its toll on me this morning

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply