What happens to the transaction in this SQL if it's not committed?
sql, sql-server-2005, transactions
Solution
It stays open until the connection closes. When the connection is closed, the transaction is rolled back.
Current transactions can be seen in sys.dm_tran_active_transactions and sys.dm_tran_database_transactions.
Problem
If I have the following SQL: ``` BEGIN TRANSACTION SELECT val FROM myTable ``` and don't follow it up with a commit, what happens with the TRANSACTION? Does it depend upon the context/scope that it was executed (e.g. in a proc, in mgt studio)? Is there some place to see if there are transactions open that have not been committed/rolled back in a database? Thanks, Chris