begin tran save tran the_procedure_name --modify stuff if ... error ... begin rollback tran the_procedure_name commit tran return 1 end --success commit tran return 0