Search code examples
sql-serversql-server-2012database-administrationsystem-views

The table sys.dm_tran_session_transactions is always empty


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?


Solution

  • 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;