Check for Open Transactions on SQL Server Database
Recently had need of a SQL Server script that can tell me if there are open transactions on the database. The script below worked for me:
USE MASTER
GO
SELECT spid,
PROGRAM_NAME,
nt_userName,
loginame,
DB_NAME(s.dbid) AS DatabaseName,
CR.TEXT AS Query
FROM sysprocesses s
CROSS apply sys.Dm_exec_sql_text(sql_handle) CR
WHERE open_tran = 1
Source: Welcome To TechBrothersIT: DBA – How To Find Open Transactions In SQL Server
Tags: #Database #Scripts #SqlServer
Discuss... or leave a comment below.