CURRENT_TRANSACTION_ID (Transact-SQL)

**APPLIES TO:** ![yes](media/yes.png)SQL Server (starting with 2016) ![yes](media/yes.png)Azure SQL Database ![no](media/no.png)Azure SQL Data Warehouse ![no](media/no.png)Parallel Data Warehouse

This function returns the transaction ID of the current transaction in the current session.

Topic link icon Transact-SQL Syntax Conventions

Syntax

CURRENT_TRANSACTION_ID( )  
  

Return types

bigint

Return Value

The transaction ID of the current transaction in the current session, taken from sys.dm_tran_current_transaction (Transact-SQL).

Permissions

Any user can return the transaction ID of the current session.

Examples

This example returns the transaction ID of the current session:

SELECT CURRENT_TRANSACTION_ID();  

See also

sp_set_session_context (Transact-SQL)
SESSION_CONTEXT (Transact-SQL)
Row-Level Security
CONTEXT_INFO (Transact-SQL)
SET CONTEXT_INFO (Transact-SQL)