This may be a daft question as it is coming from a foggy mind. I am trying to determine when the next interval will be of a job that is scheduled to fire on the last day of every x month. In a query, I have calculated ThisMonthsJobTime, ScheduleStartJobTime and I am trying to determine the case on how to know when, at any given point in time, when is the NextFiringTime.
Let's say I have a SQL Server job starting at 02/05/2025 10:30:00 PM and it has been configured to run on the last day of the month at 10:30:00 PM every 2 months.
The @freq_recurrence_factor = 2
I am reading this as it will fire on 2/28, skip 3/31 and 4/30, and fire again on 5/31 and so on. Can I get a confirmation on this as the documentation does not go into detail about that?
To the query question. Is there any date time math magic that can be used to determine the next job run time at any given point in time? I have been working some stuff.
SELECT
IntervvalOfX,
ScheduleBeginDate,
DATEADD(DAY,DATEDIFF(DAY,ScheduleBeginDate, EOMONTH(scheduleBeginDate)),ScheduleBeginDate) AS ScheduleStartJobTime,
NextStartJobTime = 'some math based on start-time, getdate() and IntervalOfX?'
FROM
MyScheduleTable
next run date / time
? you can use sp_help_job to find out the information