I am still cutting my T-SQL teeth... I have the following error
In essence I have...
If I drop the temp table before the second select that creates it, it will compile but the temp table would not exist at execution time....
Is there a simple fix short of creating the temp table before the if statment and using an insert into instead?
Code:
Msg 2714, Level 16, State 1, Procedure <SP Name>, Line <Number>
There is already an object named '#Temp1' in the database.
In essence I have...
Code:
Create Procedure (@USE_Projection Bit = 0)
AS
/*
T-SQL Here
*/
IF @USE_Projection = 0
Select <Stuff>
Into #Temp1
From <Tables>
Else
Select <Similar Stuff>
Into #Temp1
From <Similar Tables>
End
/*
More T-SQL Here
*/
If I drop the temp table before the second select that creates it, it will compile but the temp table would not exist at execution time....
Is there a simple fix short of creating the temp table before the if statment and using an insert into instead?