Follow SQLMaster on Twitter
Welcome to SqlServer-QA.net Sign in | Help

TSQL to get list of operations in active transaction of the current session

SQL Server has a wealth of Dynamic Management Views (DMVs) to get you health status of the platform.

All the data will be extracted with a query, set of transactions and many more ways, in this case you had to be careful with transactions, because whenever so much data was flowing back and forth between the application server and the database
server, too many things could go wrong. Here is the quick DMV that can get you list of operations in active transaction of the current session

declare @xactid bigint

declare @transactionid nvarchar(28)

select @xactid = transaction_id from sys.dm_tran_current_transaction

select @transactionid = [transaction id] from fn_dblog(null,null) where [Xact ID] = @xactid

select * from fn_dblog(null,null) where [Transaction ID] = @transactionid

 

The [Xact ID] introduced in SQL Server 2008 has the transaction id for the operation LOP_BEGIN_XACT and all the transaction occuring in its context share the common transaction with the [transaction id] column

Published Wednesday, January 27, 2010 6:46 AM by SQL Master

Comments

# SQL Server Transact-SQL (SSQA.net) : TSQL to get list of operations in active transaction of the current session

# TSQL to get list of operations in active transaction of the current session

SQL Server has a wealth of Dynamic Management Views (DMVs) to get you health status of the platform.

Wednesday, January 27, 2010 7:24 AM by Other SQL Server Blogs around the Web

# TSQL to get list of operations in active transaction of the current session

Kudos for a great Sql Server article - Trackback from SqlServerKudos

Thursday, January 28, 2010 5:35 AM by SqlServerKudos
Anonymous comments are disabled