Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Single transaction for multiple steps (scheduled job t-sql)

I wonder if it is possible to cover all the steps of a job with a single transaction. Like,

TRY (BEGIN TRAN; STEP1 ) CATCH(ROLLBACK)
TRY (STEP2) CATCH(ROLLBACK)
TRY (STEP3-last step) CATCH(ROLLBACK)COMMIT;

Thanks.

like image 470
OzanYukruk Avatar asked Dec 03 '25 07:12

OzanYukruk


1 Answers

Not that I'm aware of; steps are atomic units of work in a job. If you need to cover them all in a transaction, you should move all of the activities into a single step.

like image 134
Stuart Ainsworth Avatar answered Dec 06 '25 17:12

Stuart Ainsworth