patd1
asked on
Stored proc not getting created because temp table already exists.
Using Sql Server 2012
I am using the following code where ever I am creating a temp table #wt3 in my stored proc code. But when I hit execute to create this SP I get the error mentioned below, at the second instance of creating this temp table:
Error:
Msg 2714, Level 16, State 1, Procedure rollup_scores, Line 1463
There is already an object named '#wt3' in the database.
What am I missing?
Thank you.
I am using the following code where ever I am creating a temp table #wt3 in my stored proc code. But when I hit execute to create this SP I get the error mentioned below, at the second instance of creating this temp table:
IF (OBJECT_ID('tempdb..#wt3')) IS NOT NULL
DROP TABLE #wt3
SET ANSI_WARNINGS OFF
SELECT TOP 0 * INTO #wt3 FROM db_template.dbo.DimTime
Error:
Msg 2714, Level 16, State 1, Procedure rollup_scores, Line 1463
There is already an object named '#wt3' in the database.
What am I missing?
Thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER