if object_id('tempdb..#临时表') is not null
drop table #临时表
else 
creeate table #临时表..

解决方案 »

  1.   

    if Exists(Select * from tempdb..sysobjects where Name Like '#临时表名%')
       Drop table #临时表名
      

  2.   

    所有创建的临时表全部放在tempdb数据库里.表名为 临时表名__________________
      

  3.   

    if object_id('tempdb..#表名') is not null
      select '存在'
      

  4.   

    if object_id('tempdb..#表名') is not null
      select 'exists!'
      

  5.   

    if exists(select * from tempdb.dbo.sysobjects where xtype='u' and name like '#vlist%')
      drop table #vlist