1

I was looking at some `worktable' from the query below by my friend Martin

SELECT st.session_id
        ,at.*,
 case transaction_type   
      when 1 then 'Read/Write'   
      when 2 then 'Read-Only'    
      when 3 then 'System'   
      when 4 then 'Distributed'  
      else 'Unknown - ' + convert(varchar(20), transaction_type)     
 end as tranType,    
 case transaction_state 
      when 0 then 'Uninitialized' 
      when 1 then 'Not Yet Started' 
      when 2 then 'Active' 
      when 3 then 'Ended (Read-Only)' 
      when 4 then 'Committing' 
      when 5 then 'Prepared' 
      when 6 then 'Committed' 
      when 7 then 'Rolling Back' 
      when 8 then 'Rolled Back' 
      else 'Unknown - ' + convert(varchar(20), transaction_state) 
 end as tranState, 
 case dtc_state 
      when 0 then NULL 
      when 1 then 'Active' 
      when 2 then 'Prepared' 
      when 3 then 'Committed' 
      when 4 then 'Aborted' 
      when 5 then 'Recovered' 
      else 'Unknown - ' + convert(varchar(20), dtc_state) 
 end as dtcState
FROM    sys.dm_tran_active_transactions at
  left JOIN sys.dm_tran_session_transactions st ON st.transaction_id = at.transaction_id
ORDER BY at.transaction_begin_time


enter image description here

one thing that called my attention is the fact that these transactions don't have a corresponding session?

how can I find out where they are coming from?

There is no session associated with them.

1
  • Are you troubleshooting something else that depends on that info, like some performance issue? I ask because it might give a clue if you're chasing a red herring.
    – Ronaldo
    Commented Nov 28 at 10:33

1 Answer 1

1

My guess is that they belong to internal sessions used by SQL Server engine. I have an instance on my desktop, which I just started in order to check that, and after executing that same query the result looks pretty much like yours:

Query output

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.