Posts

Showing posts from June, 2025

Query SQL Server Agent Job Information

https://www.mssqltips.com/sqlservertip/2561/querying-sql-server-agent-job-information/  

How SQL Server Determines the Next Run Date for SQL Agent Jobs

  SQL Server calculates the   next run date   for SQL Agent jobs based on the job's schedule configuration stored in the   msdb   database. The key components involved in this process include the   sysjobschedules ,   sysschedules , and   sysjobactivity   tables, along with background processes in the SQL Server Agent. Key Mechanism for Next Run Date Calculation The  next run date  and  time  are primarily stored in the  sysjobschedules  table. However, these values are not updated in real-time. Instead, they are refreshed periodically by a background thread in SQL Server Agent, known as the  "Schedule Saver" thread , which typically runs every 20 minutes. This delay can cause discrepancies if you check the  sysjobschedules  table immediately after modifying a schedule. For real-time updates, the  sysjobactivity  table is more reliable. This table is updated immediately whenever a job sch...

Query SQL Server Agent Jobs, Steps, History and System Tables

https://www.mssqltips.com/sqlservertip/6111/query-sql-server-agent-jobs-job-steps-history-and-schedule-system-tables/