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

Viewed 46337

I have a stored procedure on SQL Server 2000. It contains:
select ... into ##Temp ...
...
drop table ##Temp

When I run the stored procedure with ADO a second time, it prompts:
There is already an object named '##Temp' in the database.
Could anyone kindly tell me what's wrong?

5 Answers

For me this solution works :

IF (SELECT object_id ='#Temp') IS NOT NULL
BEGIN
   DROP TABLE #Temp
END
Related