See http://www.cnblogs.com/hongten/archive/2011/06/18/2084036.html
Using one transaction name in a series of nested transactions to name multiple transactions has no effect on this transaction. The system registers only the first (most external) transaction name. Rolling back to any other name (except for storing names effectively) produces an error.
In fact, no statement executed before rollback is rolled back when an error occurs. This statement will be rolled back only when the outer transaction is rolled back.
For example, an error is returned when an internal transaction is rolled back to SQL Server.
Begin Tran T1
Insert into demo2 (name, age) values ('Lis ', 1)
--- Second Trans
Begin transaction T2
Insert into demo values ('bb ',' B terminologies ')
RollbackTransaction T2
---- In the first trans.
Insert into demo2 (name, age) values ('Lis ', 2)
Commit transaction T1
An error is reported during transaction T2 rollback:
-- Server: MSG 6401, level 16, state 1, line 6
-- Cannot roll back T2. no transaction or savepoint of that name was found.
For example, SQL server does not report an error when internal transactions are committed.
Begin Tran T1
Insert into demo2 (name, age) values ('Lis ', 1)
Begin transaction t2
Insert into demo values ('bb ',' B terminologies ')
CommitTransaction t2 -- correct
---- In the first trans.
Insert into demo2 (name, age) values ('Lis ', 2)
Commit transaction t1