Monday, March 19, 2012

Got err: There is already an object named '#TEMP' in the database.

I have the drop table #temp at the end of my stored prodedure but I think it
got executed half way and left the #temp there. I try executing the drop
table #temp but it says there is not #temp table. But if I run the alter
procedure again then I get the err message that the #temp table already
exist.
I tried stop and start the sql engine but that doesn't work. I restarted
the PC and it still won't go away. Does anyone know how to get rid of this?
Thanks, AlphaBefore you try to create the #temp table,
IF OBJECT_ID('tempdb..#TEMP') IS NOT NULL
DROP TABLE #TEMP
Of course, your initial problem should have gone away if you opened a new
session in Query Analyzer.
A
"Alpha" <Alpha@.discussions.microsoft.com> wrote in message
news:13DC4502-7F82-44B9-B123-E35043837DDE@.microsoft.com...
>I have the drop table #temp at the end of my stored prodedure but I think
>it
> got executed half way and left the #temp there. I try executing the drop
> table #temp but it says there is not #temp table. But if I run the alter
> procedure again then I get the err message that the #temp table already
> exist.
> I tried stop and start the sql engine but that doesn't work. I restarted
> the PC and it still won't go away. Does anyone know how to get rid of
> this?
> Thanks, Alpha|||This just gets worse. I change the #temp name to many different other names
and I keep getting the same message that it already exist.
"Alpha" wrote:

> I have the drop table #temp at the end of my stored prodedure but I think
it
> got executed half way and left the #temp there. I try executing the drop
> table #temp but it says there is not #temp table. But if I run the alter
> procedure again then I get the err message that the #temp table already
> exist.
> I tried stop and start the sql engine but that doesn't work. I restarted
> the PC and it still won't go away. Does anyone know how to get rid of thi
s?
> Thanks, Alpha|||Maybe you could show your code...
"Alpha" <Alpha@.discussions.microsoft.com> wrote in message
news:0F8B1D0C-6CD7-42D5-BE0E-4D473E39C188@.microsoft.com...
> This just gets worse. I change the #temp name to many different other
> names
> and I keep getting the same message that it already exist.

No comments:

Post a Comment