MS SQL Server 2012 - DBA Articles |
BEGIN ... ROLLBACK Transaction Process FlowROLLBACK Transaction is an explicit or implicit transaction to the beginning of the transaction, or to a SAVEPOINT inside the transaction. ROLLBACK Transaction is used to erase all data modifications made from the start of the transaction or to a SAVEPOINT. Syntax --
Syntax -- ROLLBACK { TRAN | TRANSACTION }
[
transaction_name | @tran_name_variable
| savepoint_name | @savepoint_variable ] [
; ] --
Example 68 -- SELECT * FROM EMP BEGIN TRANSACTION MyTransaction DELETE FROM EMP WHERE Emp_Code = 501; ROLLBACK TRANSACTION MyTransaction GO SELECT * FROM EMP |
* * * * *