This ability to compose transactions is their main benefit over other kinds of concurrency control!
This ability to compose transactions is their main benefit over other kinds of concurrency control!
Which works entirely fine in most cases. You're at greater risk of phantom reads and general "stuff that can occur while you hold open a transaction", but if you're not handling that correctly then you're not handling that correctly. It's only a matter of volume, not existence.
... with a clear exception for cases where you do need to truly end a transaction, like if you're relying on some other thread to do something on a different transaction that needs to see your changes, or when you risk a deadlock somewhere due to not releasing your lock. Those are both a risky patterns for a lot of reasons though, and worth avoiding at design-time if at all possible.
BEGIN TRAN
BEGIN TRAN
COMMIT TRAN
ROLLBACK TRAN