We have two possible transactions. I'm trying to decide which I should use? They will be covering an UPDATE statement followed by a DELETE statement.
What is the difference?.
When is the stuff done? With the COMMIT is the stuff just set up during the "do stuff" statement and actually done when the COMMIT statement runs. What happens if it fails during the COMMIT?
With the ROLLBACK is the stuff done on the do "some other stuff" statement and then, if something goes wrong, the transaction is reversed?
Code:
BEGIN TRAN A
[indent]do some stuff[/indent]
COMMIT
BEGIN TRAN B
[indent] do some other stuff[/indent]
ROLLBACK
What is the difference?.
When is the stuff done? With the COMMIT is the stuff just set up during the "do stuff" statement and actually done when the COMMIT statement runs. What happens if it fails during the COMMIT?
With the ROLLBACK is the stuff done on the do "some other stuff" statement and then, if something goes wrong, the transaction is reversed?