SET XACT_ABORT ON --any error, rollback any trnasactionsBEGIN TRAN--do first update--second update....--last updateCOMMIT TRAN --if there was any error, everything rollsback, no error checking needed
ALTER procedure MyProc AsBEGINbegin transactionupdate1if @@error != 0 GOTO Bailoutupdate2if @@error != 0 GOTO Bailoutinsert1if @@error != 0 GOTO Bailoutinsert2if @@error != 0 GOTO Bailoutcommit transactionreturn 0 --by returning, no lines below this point will be executed UNLESS sent there directly by the GOTO commandBailout:print 'Error!'rollback transactionreturn 1END