SQL 判断表是否存在

如果是实表可以用

if exists (select * from sysobjects where id = object_id(N'[dbo].[表名]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[表名]--如果表存在就删除

如果是临时表可以用

if   object_id('tempdb..##temp')   is   not   null  
   drop   table   ##temp  

原文地址:https://www.cnblogs.com/hantianwei/p/1961777.html