I have a service where you load data from an ERP into a DW. Because the data source is SQL Server 2008 R2 10.50.1600.1 and the destination server MS SQL Server 2008 10.0.5512.0 SP3.
The service executes a stored procedure that generates temporary tables that feeds a physical table that generates the query that feeds the DW tables.
Temporary tables created by the query even after deletion are kept loaded in the TempDB
database.
The query is running for hours instead of the load on the target bank.
Even after executing the command a below the tables remain in the TempDB database:
IF EXISTS(SELECT * FROM Tempdb..SysObjects WHERE Name LIKE'%#TEMP%')
DROP TABLE #TEMP
The permission level has been changed in if the problem persists.
Error presented:
Can not drop the table '#temp' because it does not exist or you do not have permission. [SQLSTATE 42S02] (Error 3701).