sql数据库中已存在名为 '#tmp' 的对象怎么解决

insert into #tmp (id_vip)
select a.id_vip from a inner join b on a.id_vip=b.id_vip

delete from a where id_vip in (select id_vip from #tmp)
delete from b where id_vip in (select id_vip from #tmp)

在执行另的二个表时如是C表,B表时,会提示数据库中已存在名为 '#tmp' 的对象。
请问怎么解决这个问题谢谢

第1个回答  2012-05-15
if object_id('tempdb..#tempTable') is not null
Begin
drop table #tempTable
End本回答被提问者采纳
第2个回答  2012-05-15
rename
第3个回答  2012-05-15
学习下
相似回答