|
declare @ number1 int
declare @ number2 int
set @ number1 = 1
set @ number2 = 2
begin transaction
select @ number1
rollback transaction
select @ number2
commit transaction
Is this understandable? The above statements are wrong because the rollback transaction is executed first.
So the transaction has ended. And the subsequent commit transaction will not correspond to the new begin transaction (because the first begin transaction has ended), so the program will be wrong. Do you understand this? |
|