title | description | author | ms.author | ms.date | ms.service | ms.subservice | ms.topic | f1_keywords | helpviewer_keywords | dev_langs | ||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
CURRENT_TRANSACTION_ID (Transact-SQL) |
CURRENT_TRANSACTION_ID (Transact-SQL) |
markingmyname |
maghan |
07/24/2017 |
sql |
t-sql |
reference |
|
|
|
[!INCLUDE sqlserver2016-asdb-asdbmi]
This function returns the transaction ID of the current transaction in the current session.
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions
CURRENT_TRANSACTION_ID( )
bigint
The transaction ID of the current transaction in the current session, taken from sys.dm_tran_current_transaction (Transact-SQL).
Any user can return the transaction ID of the current session.
This example returns the transaction ID of the current session:
SELECT CURRENT_TRANSACTION_ID();
sp_set_session_context (Transact-SQL)
SESSION_CONTEXT (Transact-SQL)
Row-Level Security
CONTEXT_INFO (Transact-SQL)
SET CONTEXT_INFO (Transact-SQL)