Did you test it? On my 2008 server it's returning exactly what you asked for.
Test: Open 2 management studio windows.
Window 1: Connect to AdventureWorks and run
SET SalariedFlag = 0
WHERE BusinessEntityID = 42
Window 2: Run the second transaction script that I posted: (I've reduced the number of columns to keep it clear)
SELECT ec.session_id, tst.is_user_transaction, st.text
FROM sys.dm_tran_session_transactions tst
INNER JOIN sys.dm_exec_connections ec ON tst.session_id = ec.session_id
CROSS APPLY sys.dm_exec_sql_text(ec.most_recent_sql_handle) st
Session_id and last run statement for the open transaction. If you want things like login name, join in sys.dm_exec_sessions (joins on session_id)
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)SQL In The Wild
: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter
We stand on the bridge and no one may pass