Skip to content

Latest commit

 

History

History
64 lines (50 loc) · 2.18 KB

File metadata and controls

64 lines (50 loc) · 2.18 KB
title CURRENT_TRANSACTION_ID (Transact-SQL) | Microsoft Docs
ms.custom
SQL2016_New_Updated
ms.date 2015-12-18
ms.prod sql-non-specified
ms.reviewer
ms.suite
ms.technology
database-engine
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 BYHAM
ms.author rickbyh
manager jhubbard

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)