SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Open transactions on a database

By kyle.eldridge,

Updated 06/03/2013:

-- Added database support to query a specific database.

-- due to this, i have removed mdsd.NAME AS 'Database with open Transaction'

-- Fixed some code which was causing the open transactions to display incorrectly.

-- Fixed the transaction isolation levels to show unspecified, read uncommitted, read committed, repeatable read, serializable and also snapshot.

Initial Release:

This script was produced due to slowness on one of our servers.

The slowness was caused by a transaction which was undetected due to a number of query windows being open.

this script will show you the following:

  • Computer/Host Name
  • Windows Username
  • Database which the transaction is being run from
  • Session ID
  • Number of open transactions
  • Date the query window was first opened.
  • If the query window is a user process or not
  • The transaction isolation level
  • Lock timeout of the query.

Total article views: 3762 | Views in the last 30 days: 5
Related Articles

Process to truncate transaction log of replicated database

This article demonstrated the steps which you must follow to gracefully truncate the publisher datab...


Unable to connect to Database Engine on New Query Window

Query Window not connecting to the DB Engine


Check Statement aborted. Database contains deferred transactions.

Please help me, Check statement aborted. Database contains deferred transactions.


Long running transactions

Need to create a monitor which can Query a Database


Database mirroring with transactional replication

Database mirroring with transactional replication