Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

There is already an object named '#Temp' in the database.

$
0
0

run the below sql...I am getting the below error message. May I know what could be wrong here ?

There is already an object named '#Temp' in the database.

Query 

IF (Select object_id('TempDB..#Temp')) IS NOT NULL
 BEGIN
        DROP TABLE #Temp
  SELECT TOP 0 * INTO #Temp FROM db_template.dbo.DimTime
    END
ELSE

 SELECT TOP 0 * INTO #Temp FROM db_template.dbo.DimTime


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>