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
#Database #SQL #SoftwareDevelopment
Links to this page: Weeknotes – 009
Find me on Mastodon (@dino@writing.exchange) or Micro.blog (@Dino)