I have never understood what a nested transaction is good for. Committing a nested transaction commits nothing - it just decreases @@TRANCOUNT
. And ROLLBACK
rolls back everything.
BEGIN TRANSACTION
//do an update
BEGIN TRANSACTION
//do an insert
COMMIT TRANSACTION
COMMIT TRANSACTION
What is the difference with this:
BEGIN TRANSACTION
//do an update
//do an insert
COMMIT TRANSACTION
Please give me an example why should nested transactions be used and how they make a difference.