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

前端 未结 5 1750
广开言路
广开言路 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:01

    Since you chose to use a global temporary table ##Temp, it is visible to all SQL connections at any given time. Obviously, while the stored proc is running for one connection, a second connection comes in and tries to create yet another ##Temp but that already exists....

    Use connection-local #Temp tables (only one #) instead.

提交回复
热议问题