Suppose I have a query:
begin tran
-- some other sql code
And then I forget to commit or roll back.
If another client tries to exec
Transactions are intended to run completely or not at all. The only way to complete a transaction is to commit, any other way will result in a rollback.
Therefore, if you begin and then not commit, it will be rolled back on connection close (as the transaction was broken off without marking as complete).