判断临时表是否存在,存在就删除

--下面以临时表#temp为例,判断它是否存在,存在就删除它
IF OBJECT_ID('tempdb..#temp') is not null
drop table #temp



--方法一
1if exists (select * from tempdb.dbo.sysobjects where id = object_id(N'tempdb..#tempcitys') and type='U')2    drop table #tempcitys

--方法二
if object_id('tempdb..#tem') is not null 
begin 
print 'exists' 
end 
else 
begin 
print 'not exists' 
end

文章名称:判断临时表是否存在,存在就删除
URL分享:http://lszwz.com/article/psspsh.html

其他资讯

售后响应及时

7×24小时客服热线

数据备份

更安全、更高效、更稳定

价格公道精准

项目经理精准报价不弄虚作假

合作无风险

重合同讲信誉,无效全额退款