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

前端 未结 5 1733
广开言路
广开言路 2021-01-04 04:23

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

When I run the stored procedure

5条回答
  •  日久生厌
    2021-01-04 05:08

    You are using a global temp table as indicated by the ## at the beginning of the table name. This means multiple sessions can access the table.

    It's likely that you have a connection open that created the table, but failed to drop it. Are you sure that the first ADO run actually drop the table. Could it have failed, or did the flow control in the procedure skip the drop statement?

    You may want to test the procedure in SQL Server Enterprise Manager to see if it reports any errors.

提交回复
热议问题