SQL查询是否存在某个表
IF NOT EXISTS ( SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[表名]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1 ) begin SELECT '不存在' END ELSE BEGIN SELECT '存在' end
IF NOT EXISTS ( SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[表名]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1 ) begin SELECT '不存在' END ELSE BEGIN SELECT '存在' end