判断临时表/正式表是否存在?
--判断临时表是否存在 IF EXISTS ( SELECT * FROM tempdb..sysobjects WHERE id = OBJECT_ID('tempdb..#Frequency') ) PRINT 'yes'; IF EXISTS ( SELECT * FROM tempdb.dbo.sysobjects WHERE id = OBJECT_ID(N'tempdb..#Frequency') AND type = 'U' ) PRINT 'yes'; --判断数据表是否存在 IF OBJECT_ID(N'tablename', N'U') IS NOT NULL PRINT '存在'; ELSE PRINT '不存在';