Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
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: 3702 | Views in the last 30 days: 18
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


Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones