0

I am developing a custom system for scheduling task & I am following Microsoft SQL Server Agent approach to schedule task.

I have replicated sysschedules table for capturing users scheduling occurrences and timings.

Now I need to know how SQL Server get the Next_run_date and time from this table.

I have found a solution on the internet which are using sysjobhistory table to get the next run date, but in my case, I have an only sysschedules table. So, what is the formula to calculate the next_run_date and time for any job?

Note: I am looking for entire code, concept/algorithm will work for me.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Nikunj
  • 31
  • 1
  • 4
  • If you are using SQL Server Express you could consider using [Task Scheduler](https://stackoverflow.com/questions/287060/scheduled-run-of-stored-procedure-on-sql-server/41909818#41909818). If you need application level scheduling you could search for [Quartz](http://www.quartz-scheduler.org/). Writing own bulletproof scheduler is not a trivial task. – Lukasz Szozda Apr 14 '18 at 07:01
  • my plan like, I have one job which run every 30 min and it will checks next_run_date of schedule tables and based on it if it falls within that schedule then it populate metrics value in database tables. It is background Database process – Nikunj Apr 14 '18 at 09:36
  • Then use Task Scheduler – Lukasz Szozda Apr 14 '18 at 14:25

0 Answers0