I have a schedule that does something daily, every two hours in a time interval. I want to set an end date for this schedule, but I'm wondering if it is inclusive or exclusive. In other words, if I set the end date at march 26, will today be the last day it runs, or tomorrow (it is march 25 today).
There is also an end time that needs to be considered. Any job that would run after the end date/time will not be run. So it's effectively exclusive.
From MSDN:
SQL Server Agent automatically disables schedules that are no longer current. If you edit the schedule after it has been disabled by SQL Server Agent, you must explicitly reenable it. Schedules are disabled if:
They are defined to run on a recurring schedule, and the end date has passed.
There were also some problems with earlier versions of SQL Server, with regards to end dates.
If you look in the msdb database, using the sysschedules_localserver_view view, then you can see the schedule along with an end date (active_end_date = March 26) and an end time (active _end_time) which will most likely be 235959, meaning that any job scheduled with an end date of March 26 will run on March 26, and the first day "missed" will be the 27th. I can confirm this from bitter experience that with an end date set in the Job - Schedules dialog, the job will run on that date. So the end date is Inclusive.
There is also an end time that needs to be considered. Any job that would run after the end date/time will not be run. So it's effectively exclusive.
From MSDN:
SQL Server Agent automatically disables schedules that are no longer current. If you edit the schedule after it has been disabled by SQL Server Agent, you must explicitly reenable it. Schedules are disabled if:
They are defined to run on a recurring schedule, and the end date has passed.
There were also some problems with earlier versions of SQL Server, with regards to end dates.
© 2022 - 2025 — McMap. All rights reserved.