0

I have an update statement I need to run on a table, however due to the size of this table the update takes an incredibly long time to run.

I want to create a SQL server job to run this update script for 3 hours every morning before business hours.

What I'm unsure about is, at the end of the 3 hours, it will obviously not be done updating every row, will the job just keep running until the update is complete or will it simply just stop updating any more rows until the next scheduled time? or will it fail all together?

Have not tried as this is in a live environment.

Thom A
  • 88,727
  • 11
  • 45
  • 75
  • Agent Jobs don't have a "timeout" property; the job will keep running until it complete, fails, or is *forced* to stop. If it's forced to stop, any uncommitted transactions will be rolled back. – Thom A Mar 20 '23 at 13:16
  • 2
    If you have a task that is taking such a long time to run, then I would *suggest* that performance tuning would be your first step. Batching would be your second, so that you can (at least) ensure that the script commits those batches prior to *something* forcing the agent task to stop; then at least the next time the job runs it can (hopefully) pick up from the first point *after* the last committed change. – Thom A Mar 20 '23 at 13:17
  • *Have not tried* do you have a DEV / UAT enviromnent? – Stu Mar 20 '23 at 13:35

0 Answers0