--下面以臨時表#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
判斷臨時表是否存在,存在就刪除
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.