SQLServer 中的存储过程中判断临时表是否存在,存在则删除临时表

IF OBJECT_ID('TEMPDB..#BCROSSREFERENCE ') IS NOT NULL
DROP TABLE #BCROSSREFERENCE 
IF OBJECT_ID('TEMPDB..#SCVTMP_BCUSTOMER') IS NOT NULL
DROP TABLE #SCVTMP_BCUSTOMER
IF OBJECT_ID('TEMPDB..#PDS_CREATE_SCV_TEMP') IS NOT NULL
DROP TABLE #PDS_CREATE_SCV_TEMP
IF OBJECT_ID('TEMPDB..#MASTER_NOTIN_LCSTSA') IS NOT NULL
DROP TABLE #MASTER_NOTIN_LCSTSA
IF OBJECT_ID('TEMPDB..#MASTER_NOTIN_LCSTCCG') IS NOT NULL
DROP TABLE #MASTER_NOTIN_LCSTCCG

  

ALTER TABLE #TEMP3 ADD ID INT IDENTITY(1,1)

给临时表加上自增ID

posted @ 2019-01-15 14:55  巴黎爱工作  阅读(4142)  评论(0编辑  收藏  举报