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

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

1

2

3

4

5

6

7

8

9

10

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

------------------------- A little Progress a day makes you a big success... ----------------------------

posted @ 2019-08-02 15:16  grj001  阅读(1255)  评论(0编辑  收藏  举报