您的位置:首页 > 数据库

判断临时表是否存在与判断表是否存在SQL

2017-09-19 16:42 253 查看
如果是临时表,语句如下(#推柜订单 is table name)

IF OBJECT_ID(‘tempdb..#推柜订单’) is not null

drop table #推柜订单

go

如果是正常的表(月度推柜报表 is the table name)

if exists (select 1

from sysobjects

where id = object_id(‘月度推柜报表’)

and type = ‘U’)

drop table 月度推柜报表

go
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: