Deletes a 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:
For details about the permissions of these roles, see SQL Server Agent Fixed Database Roles.
Only members of the sysadmin role can delete a job schedule that is owned by another user.
A. Deleting a schedule
The following example deletes the schedule NightlyJobs. If the schedule is attached to any job, the example does not delete the schedule.
USE msdb ; GO EXEC dbo.sp_delete_schedule @schedule_name = N'NightlyJobs' ; GO
B. Deleting a schedule attached to a job
The following example deletes the schedule RunOnce, regardless of whether the schedule is attached to a job.
USE msdb ; GO EXEC dbo.sp_delete_schedule @schedule_name = 'RunOnce', @force_delete = 1; GO