The table sys.dm_tran_session_transactions is always empty

346 views Asked by At

Hello whenever I select in a new query from the system view sys.dm_tran_session_transactions I get always 0 rows

select * from sys.dm_tran_session_transactions

But people on some other answers use this table.

SQL Server 2005 : map Transaction_ID to @@SPID

Why have I empty this view?

1

There are 1 answers

2
Dan Guzman On BEST ANSWER

The sys.dm_tran_session_transactions DMV will return sessions with open transactions so it seems there were no such sessions when you ran the query. Start a transaction to see the an example of data returned:

BEGIN TRAN;
SELECT * FROM sys.dm_tran_session_transactions;
ROLLBACK;