Chetan Bharat
Chetan Bharat

Reputation: 13

How to get Current Transaction Id in SQL Azure

In Non-Azure, I can get the current transaction details by using following query but the support to this view is removed from SQL Azure and I did not find anything similar which can tell me current transaction Id.

select * from sys.dm_tran_current_transaction

Upvotes: 1

Views: 1045

Answers (2)

Lord Darth Vader
Lord Darth Vader

Reputation: 2005

Is this not a more correct way of doing this

SELECT CURRENT_TRANSACTION_ID()

From

Link

Upvotes: 0

Craig Selbert
Craig Selbert

Reputation: 777

I had the exact same issue and I was able to solve it using the following SQL statement in my trigger

select @TransactionId = transaction_Id from 
sys.dm_tran_session_transactions 
where session_id = @@spid

This seems to give me what I was looking for and I hope it will help you.

Upvotes: 1

Related Questions