Skip to content

Latest commit

 

History

History
63 lines (46 loc) · 2.01 KB

File metadata and controls

63 lines (46 loc) · 2.01 KB
title CURRENT_TRANSACTION_ID (Transact-SQL)
description CURRENT_TRANSACTION_ID (Transact-SQL)
author markingmyname
ms.author maghan
ms.date 07/24/2017
ms.service sql
ms.subservice t-sql
ms.topic reference
ms.custom
ignite-2025
f1_keywords
CURRENT_TRANSACTION_ID
CURRENT_TRANSACTION_ID_TSQL
sys.CURRENT_TRANSACTION_ID
sys.CURRENT_TRANSACTION_ID_TSQL
helpviewer_keywords
CURRENT_TRANSACTION_ID function
dev_langs
TSQL

CURRENT_TRANSACTION_ID (Transact-SQL)

[!INCLUDE sqlserver2016-asdb-asdbmi-fabricsqldb]

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

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)