March 2018
Intermediate to advanced
816 pages
19h 35m
English
The CURRENT_TRANSACTION_ID function, as its name suggests, returns the transaction ID of the current transaction. The scope of the transaction is the current session. It has the same value as the transaction_id column in the Dynamic Management Views (DMV) sys.dm_tran_current_transaction. The function has no input arguments and the returned value is of type bigint.
Multiple calls of this function will result in different transaction numbers, since every single call is interpreted as an implicit transaction:
SELECT CURRENT_TRANSACTION_ID(); SELECT CURRENT_TRANSACTION_ID(); BEGIN TRAN SELECT CURRENT_TRANSACTION_ID(); SELECT CURRENT_TRANSACTION_ID(); COMMIT
The result on my machine is as follows (you will definitely ...
Read now
Unlock full access