原文来自:http://www.cnblogs.com/szfhquan/p/4229150.html

方法一: 

1 if exists (select * from tempdb.dbo.sysobjects where id = object_id(N'tempdb..#tempcitys') and type='U')
2    drop table #tempcitys

注意tempdb后面是两个. 不是一个的

 

方法二:

if object_id('tempdb..#tem') is not null 
begin 
print 'exists' 
end 
else 
begin 
print 'not exists' 
end

相关文章:

  • 2022-12-23
  • 2021-10-30
  • 2022-12-23
  • 2022-12-23
  • 2021-08-08
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-07
  • 2022-01-11
  • 2021-11-02
相关资源
相似解决方案