Skip to content

Latest commit

 

History

History
63 lines (50 loc) · 2.21 KB

File metadata and controls

63 lines (50 loc) · 2.21 KB
title CURRENT_TRANSACTION_ID (Transact-SQL) | Microsoft Docs
ms.custom
ms.date 07/24/2017
ms.prod sql
ms.prod_service database-engine, sql-database
ms.component t-sql|functions
ms.reviewer
ms.suite sql
ms.technology t-sql
ms.tgt_pltfrm
ms.topic language-reference
f1_keywords
CURRENT_TRANSACTION_ID
CURRENT_TRANSACTION_ID_TSQL
sys.CURRENT_TRANSACTION_ID
sys.CURRENT_TRANSACTION_ID_TSQL
helpviewer_keywords
CURRENT_TRANSACTION_ID function
ms.assetid 82cd9f92-d935-45a0-a433-620d6e15b467
caps.latest.revision 6
author edmacauley
ms.author edmaca
manager craigg

CURRENT_TRANSACTION_ID (Transact-SQL)

[!INCLUDEtsql-appliesto-ss2016-asdb-xxxx-xxx-md]

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

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

The following 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)