SELECT @cpu_time_start = cpu_time, @elapsed_time_start = total_elapsed_time FROM sys.dm_exec_sessions WHERE session_id = @@SPID IF OBJECT_ID ('tempdb.dbo.#tmp_requests') IS NOT NULL DROP TABLE ...
This script detects when there are sleeping sessions with open transactions older than 10 minutes by default. Such sessions can cause blocking and can prevent the transaction log from clearing, ...