Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

sys.dm_tran_current_transaction (Transact-SQL)

Applies To: SQL Server 2014, SQL Server 2016 Preview

Topic Status: Some information in this topic is preview and subject to change in future releases. Preview information describes new features or changes to existing features in Microsoft SQL Server 2016 Community Technology Preview 2 (CTP2).

Returns a single row that displays the state information of the transaction in the current session.

Applies to: SQL Server (SQL Server 2008 through current version), SQL Database V12.


Column name

Data type




Transaction ID of the current snapshot.



Sequence number of the transaction that generates the record version.



Snapshot isolation state. This value is 1 if the transaction is started under snapshot isolation. Otherwise, the value is 0.



Lowest transaction sequence number of the transactions that were active when a snapshot was taken. On execution, a snapshot transaction takes a snapshot of all of the active transactions at that time. For nonsnapshot transactions, this column shows 0.



Global sequence number. This value represents the last transaction sequence number that was generated by the system.



Global sequence number. This value represents the oldest transaction sequence number of the transaction that has row versions that must be retained in the version store. Row versions that were created by prior transactions can be removed.

On SQL Server requires VIEW SERVER STATE permission on the server.

On SQL Database Premium Tiers requires the VIEW DATABASE STATE permission in the database. On SQL Database Standard and Basic Tiers requires the SQL Database admin account.

The following example uses a test scenario in which four concurrent transactions, each identified by a transaction sequence number (XSN), are running in a database that has the ALLOW_SNAPSHOT_ISOLATION and READ_COMMITTED_SNAPSHOT options set to ON. The following transactions are running:

  • XSN-57 is an update operation under serializable isolation.

  • XSN-58 is the same as XSN-57.

  • XSN-59 is a select operation under snapshot isolation.

  • XSN-60 is the same as XSN-59.

The following query is executed within the scope of each transaction.

  FROM sys.dm_tran_current_transaction;

Here is the result for XSN-59.

transaction_id       transaction_sequence_num transaction_is_snapshot
-------------------- ------------------------ -----------------------
9387                 59                       1                       

first_snapshot_sequence_num last_transaction_sequence_num
--------------------------- -----------------------------
57                               61                      


The output shows that XSN-59 is a snapshot transaction that uses XSN-57 as the first transaction that was active when XSN-59 started. This means that XSN-59 reads data committed by transactions that have a transaction sequence number lower than XSN-57.

Here is the result for XSN-57.

transaction_id       transaction_sequence_num transaction_is_snapshot
-------------------- ------------------------ -----------------------
9295                 57                       0

first_snapshot_sequence_num last_transaction_sequence_num
--------------------------- -----------------------------
NULL                        61


Because XSN-57 is not a snapshot transaction, first_snapshot_sequence_num is NULL.

Community Additions

© 2015 Microsoft