Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are end dates for sql server job schedules inclusive or exclusive

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).

like image 212
Martijn Avatar asked Mar 25 '11 12:03

Martijn


People also ask

How does SQL Server scheduler work?

Schedulers in SQL Server DMVs Windows uses a preemptive scheduling mechanism and assigns a quantum of CPU time to every thread, when a thread consumes its quantum it is sent to a queue and other threads are granted execution.

How do I change the schedule of jobs in SQL Server?

To change the scheduling details for a job definition Click the plus sign to expand SQL Server Agent. Click the plus sign to expand the Jobs folder. Right-click the job whose schedule you want to edit and select Properties. In the Job Properties -job_name dialog box, under Select a page, select Schedules.

How do you schedule a job for SQL query to run daily?

Expand SQL Server Agent, expand Jobs, right-click the job you want to schedule, and click Properties. Select the Schedules page, and then click New. In the Name box, type a name for the new schedule. Clear the Enabled check box if you do not want the schedule to take effect immediately following its creation.

How do I get a list of jobs and schedules in SQL Server?

EVENTS table, so you can run "SELECT * FROM INFORMATION_SCHEMA. EVENTS" to see the list of scheduled jobs and information about them.


1 Answers

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.

like image 187
Anthony K Avatar answered Sep 28 '22 00:09

Anthony K