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

解决方案 »

  1.   

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

  2.   

    如果是全局临时表,就用一楼的方法,局部临时表的话不用特意drop,在会话结束以后就会删除的.
      

  3.   

    --全局临时表一样的检测方法if object_id('tempdb..##t') is not null
      print '存在临时表#t'
    else 
      print '不存在'
      

  4.   

    mgsray(我是新新新新,新来的吧):
    我建的是局部临时表,原来存储过程执行完毕后就会自动删除,3Q