1

How long can a SQL server agent job can run in general? are there any maximum run time limit settings option while creating a job ?

1 Answer 1

2

Out of the box, the SQL Server Agent Job will run continuously until it's completed. There is no maximum runtime or timeout option on the Job itself.

If you need a way to enforce a maximum runtime, you can use a second Job that monitors for the runtime of your first job, and calls sp_stop_job against it, to instruct the Agent to stop that Job. Depending on the process that is being executed this may stop the Job immediately or it may need to wait for the process to reach a stable point before it can actually stop the Job.

For more information on stopping a Job, please see the Microsoft docs on Stop a Job. Additionally, for more information on the Agent, please see the Microsoft docs SQL Server Agent.

1
  • 1
    Thanks for the information.
    – GopiMth
    May 1, 2022 at 16:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.