Handling nested transactions in Sql Server : Do rolling back out transaction roll back the inner committed transaction too ?????? big question...
SQL Server supports nesting transactions, however, writing nested transactions is usually not a good idea. The problem with nested transactions is that ROLLBACK and COMMIT statements affect multiple open transactions. Nested transactions usually occur when one stored procedure begins a transaction and then calls other procedures also using transactions before commiting the initial transaction. However, a single stored procedure could also have multiple transactions open at the same time. Despite the common belief that nested transaction problems can be mitigated by using named transactions, ROLLBACK and COMMIT statements don't behave as you would expect from the first glance. ROLLBACK TRANSACTION only maintains the name of the outermost transaction ; if you try rolling back any transaction except the outermost one, your statement will fail. The COMMIT TRAN statement, on the other hand will not fail; however, it will only commit the inner transaction, without releasing the exclus...