Is it possible to prevent a job from running again while still performing tasks?

1

I need to create a Job on sql server that runs every 5 minutes. The job must execute a stored procedure that verifies some records in the database, which, depending on its status, must perform the execution of other stored procedures. The problem is that I have noticed that some processes take a little more time and I would like to know, if possible, to indicate to the job in some way, after its execution, that it does not continue running until it has finished performing all the tasks it has subscribed.

That is, something like:

  • execution of the job
  • stop the job so it does not run again
  • execute stored procedures ... do homework
  • when all the tasks are finished, enable the job again so that it continues executing in the programmed time intervals
  • asked by Luis Acuña 26.12.2018 в 22:38
    source

    1 answer

    1

    In SQL Server, Jobs can only run one version at a time. It means that if you set it to launch every 5 minutes, if it takes 4 there is no problem, when the minute 5 arrives it will be re-launched, but if it lasts 5 'and 1' ', the call that should have been a second before is left in wait until the next multiple of 5. Check it just in case, if ... for example your Job takes 3 minutes put it every 5 temporarily and you will see how it is. Then ... do not forget to leave it at 5 as you wanted.

        
    answered by 26.12.2018 / 22:51
    source