if object_id('tempdb..#临时表名') is null
  print '不存在'
else 
  print '存在'

解决方案 »

  1.   


    create  table #11  (a int)
    select * from tempdb..sysobjects where id=object_id('tempdb..#11')
      

  2.   

    ame                                                                                                                             id          xtype uid    info   status      base_schema_ver replinfo    parent_obj  crdate                                                 ftcatid schema_ver  stats_schema_ver type userstat sysstat indexdel refdate                                                version     deltrig     instrig     updtrig     seltrig     category    cache  
    -------------------------------------------------------------------------------------------------------------------------------- ----------- ----- ------ ------ ----------- --------------- ----------- ----------- ------------------------------------------------------ ------- ----------- ---------------- ---- -------- ------- -------- ------------------------------------------------------ ----------- ----------- ----------- ----------- ----------- ----------- ------ 
    #11_________________________________________________________________________________________________________________000000000340 727777750   U     1      1      1610612736  0               0           0           2004-03-24 19:22:48.287                                0       0           0                U    1        323     0        2004-03-24 19:22:48.287                                0           0           0           0           0           0           0(所影响的行数为 1 行)