BEGIN and END define a series of Transact-SQL statements that execute together. If the BEGIN… END block were not included, both ROLLBACK TRANSACTION statements would execute and both PRINT messages would be returned.
START TRANSACTION;Â SELECT @A:=SUM(salary) FROM table1 WHERE type=1; UPDATE table2 SET summary=@A WHERE type=1; COMMIT; With START TRANSACTION , autocommit remains disabled until you end the transaction with COMMIT or ROLLBACK . The autocommit mode then reverts to its previous state.
START TRANSACTION; SELECT @A:=SUM(salary) FROM table1 WHERE type=1; UPDATE table2 SET summary=@A WHERE type=1; COMMIT; When you start a transaction with START TRANSACTION, autocommit is disabled until you finish it with COMMIT or ROLLBACK. The autocommit mode then reverts to its prior state.
