use tempdb
go
if exists(select * from sysobjects where name='##temp')
 print 1
else
 print 2

解决方案 »

  1.   

    Select * from tmpdb..sysobjects where name like '##t_zzf%'
      

  2.   

    if object_id('tempdb....##t_zzf')
      select '存在'
      

  3.   

    if exists(select * from tempdb..sysobjects where name='##temp')
     print 1
    else
     print 2
      

  4.   

    不能这样用:应当这样:if exist(slect * from ##t_zzf)
     ...
    else
      

  5.   

    if exists(select * from tempdb..sysobjects where name='##temp')
    ...
    else
     ...
      

  6.   

    临时表:
    if object_id('tempdb..temptablename') is not null
    print 'temptable exist'游标:
    if  CURSOR_STATUS('global','cursorname')=-3 and CURSOR_STATUS('local','cursorname')=-3
    print 'not exist'
      

  7.   

    if object_id('tempdb....##t_zzf')
      

  8.   

    或都不管在不在都先用 Drop Table 将它除去
      

  9.   

    if object_id('tempdb..temptablename') is not null
    存在
    else
    不在
      

  10.   


    if object_id('tempdb..##t_zzf from tcs') is not null
    存在
    else
    不在
      

  11.   

    if object_id('tempdb..##t_zzf') is not null
    select '存在'
    else
    select '不存在'