How to determine if SQL job schedule is enabled? | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

How to determine if SQL job schedule is enabled?

Hi Could someone tell me how can i by script determine which job have schedule enabled and which disabled?
Thank you
Try msdb..sp_help_job @job_name = ‘job_name’ Edit: Actually this will do
msdb..sp_help_job @job_name = ‘job_name’, @job_aspect =’JOB’ Bambola.
…1 indicates enabled jobs, and 0 indicates disabled jobs. _________
Satya SKJ
Moderator
SQL-Server-Performance.Com

no i nedded for all
Here is solution: select jobname=a.name,IsScheduleenabled=b.enabled
from msdb..sysjobs a inner join msdb..sysjobschedules b
on a.job_id=b.job_id
True, but sp_help_job output is better explained and its supported.
(MS discourages querying system tables directly, in some cases) _________
Satya SKJ
Moderator
SQL-Server-Performance.Com

but sp_help_job returns enabled job not enabled schedule!
You can use one of these to see if job’s schedule is enabled msdb..sp_help_job @job_name = ‘job_name’, @job_aspect =’SCHEDULES’
msdb..sp_help_jobschedule @job_name = ‘job_name’ or this to see all jobs that are enabled. msdb..sp_help_job @enabled = 1 Bambola.
I am not looking if jobs are enabled i am looking if there schedules are enabled
Job can be enable but schedule not so it wont run sp_help_job @enabled will return whether the job is enable not the schedule
In situations like this, I’d do the following…. Enterprise Manager tells you if a job schedule is enabled, right? So.. set up a Profiler to trace to trace what YOU are doing when you click through these things in EM. Then have a look at the Profiler output and see what EM is doing behind the scenes while you click on a job and find out if its schedule is enabled. This is very useful, e.g. seeing what EM does when it prepares a taskpad view of a database for you. Hope this helps! Tom Pullen
DBA, Oxfam GB
]]>