Generates a list or report about all the scheduled jobs, jobs, or running jobs that are visible to the caller, or about a restricted set based on the name and the option values.
sp_sjobhelp @name=’...’, @option=’...’
The name or ID of the scheduled job, a job, or a runid. The @name argument restricts the scope to a single scheduled job, all scheduled jobs using a particular job, or a single run of a scheduled job. By default, @name is the name ID of a scheduled job. To specify the name, the ID of a job, or the runid, the @name argument is prefixed with jname or runid.
Specifies a comma-separated list of options, the option_name=option_value pairs that define the action to perform, and filters to restrict the information returned.
report – format as a report.
list – format as a list.
running – produce a report of running jobs.
scheduled – produce a report of scheduled jobs.
unscheduled – produce a report of unscheduled jobs.
all_users – include information about all users.
owner – restrict to information owned by this user.
jobs – provide information about jobs.
schedules – provide information about schedules.
user – restrict information for scheduled jobs to run on behalf of this user. Applies only to running jobs.
Returns 0 on success or an error code.
The following example produces a list of all the scheduled jobs that are running:
sp_sjobhelp @option=‘list,all_users,running’
The following example produces a report showing all the jobs scheduled by the caller:
sp_sjobhelp @option=’report,scheduled’
The following example produces a list of all the jobs and schedules that are not used in any scheduled jobs:
sp_sjobhelp @option=‘list,all_users,unscheduled’
The report will be in several sections, showing the scheduled jobs, jobs that do not have schedules, and the schedules.