select * from dbo.sysobjects where id =object_id(N'statisticalData')
if object_id(N'BMS_Alarm',N'U') is not null
print '存在'
else
print '不存在'
if not exists ( select * from dbo.sysobjects where id = object_id('AddAlarmItem') and OBJECTPROPERTY(id, N'IsUserTable')=1)
print 1
else
print 0
--判断临时表是否存在
if object_id('tempdb..#hs') is not null
print 1
else
print 2
--判断物理表是否存在
if exists (select * from sysobjects where id=object_id(N'BMS_Alarm') and OBJECTPROPERTY(id, N'IsUserTable')=1)
print 1
else
print 2