判断一临时表是否存在

from :

http://www.cnblogs.com/yugen/archive/2010/07/25/1784749.html

 

2、临时表是否存在:

方法一:
use fireweb;
go

if exists(select * from tempdb..sysobjects where id=object_id('tempdb..##TEMP_TBL'))
PRINT '存在' 
ELSE 
PRINT'不存在'


方法二:
use fireweb;
go

if exists (select * from tempdb.dbo.sysobjects where id = object_id(N'tempdb..#TEMP_TBL') and type='U')
PRINT '存在' 
ELSE 
PRINT'不存在'

posted on 2012-09-18 11:25  Orz..  阅读(110)  评论(0)    收藏  举报

导航