sp_help_schedule (Transact-SQL)
Lists information about schedules.
This procedure returns the following result set:
|
Column name |
Data type |
Description |
|---|---|---|
|
schedule_id |
int |
Schedule identifier number. |
|
schedule_uid |
uniqueidentifier |
Identifier for the schedule. |
|
schedule_name |
sysname |
Name of the schedule. |
|
enabled |
int |
Whether the schedule enabled (1) or not enabled (0). |
|
freq_type |
int |
Value indicating when the job is to be executed. 1 = Once 4 = Daily 8 = Weekly 16 = Monthly 32 = Monthly, relative to the freq_interval 64 = Run when SQLServerAgent service starts. |
|
freq_interval |
int |
Days when the job is executed. The value depends on the value of freq_type. For more information, see sp_add_schedule (Transact-SQL). |
|
freq_subday_type |
int |
Units for freq_subday_interval. For more information, see sp_add_schedule (Transact-SQL). |
|
freq_subday_interval |
int |
Number of freq_subday_type periods to occur between each execution of the job. For more information, see sp_add_schedule (Transact-SQL). |
|
freq_relative_interval |
int |
Scheduled job's occurrence of the freq_interval in each month. For more information, see sp_add_schedule (Transact-SQL). |
|
freq_recurrence_factor |
int |
Number of months between the scheduled execution of the job. |
|
active_start_date |
int |
Date the schedule is activated. |
|
active_end_date |
int |
End date of the schedule. |
|
active_start_time |
int |
Time of the day the schedule starts. |
|
active_end_time |
int |
Time of the day schedule ends. |
|
date_created |
datetime |
Date the schedule is created. |
|
schedule_description |
nvarchar(4000) |
An English description of the schedule (if requested). |
|
job_count |
int |
Returns how many jobs reference this schedule. |
By default, members of the sysadmin fixed server role can execute this stored procedure. Other users must be granted one of the following SQL Server Agent fixed database roles in the msdb database:
-
SQLAgentUserRole
-
SQLAgentReaderRole
-
SQLAgentOperatorRole
For details about the permissions of these roles, see SQL Server Agent Fixed Database Roles.
Members of SQLAgentUserRole can only view the schedules that they own.
A. Listing information for all schedules in the instance
The following example lists information for all schedules in the instance.
USE msdb ; GO EXEC dbo.sp_help_schedule ; GO
B. Listing information for a specific schedule
The following example lists information for the schedule named NightlyJobs.
USE msdb ;
GO
EXEC dbo.sp_help_schedule
@schedule_name = N'NightlyJobs' ;
GO