SQL Server Oldest Open Transaction

This metric tracks the session with the oldest open transaction and returns the date difference in seconds. If you want to alert off this metric, ensure the thresholds are configured.

Query Text

SELECT ISNULL(MAX(DATEDIFF(second, start_time, CURRENT_TIMESTAMP)), 0)
FROM sys.dm_exec_requests
WHERE open_transaction_count > 0