Transact-SQL Reference

sp_delete_jobschedule

Removes a schedule from a job.

Syntax

sp_delete_jobschedule [ @job_id = ] job_id , | [ @job_name = ] 'job_name' ,
    [ @name = ] 'sched_job_name'

Arguments

[@job_id =] job_id

Is the identification number of the job from which to delete the schedule. job_id is uniqueidentifier, with a default of NULL.

[@job_name =] 'job_name'

Is the name of the job from which to delete the schedule. job_name is sysname, with a default of NULL.

Note  Either job_id or job_name must be specified; both cannot be specified.

[@name =] 'sched_job_name'

Is the name of the schedule to delete. sched_job_name is sysname, with no default.

Return Code Values

0 (success) or 1 (failure)

Result Sets

None

Remarks

Removing a schedule from a job prevents Microsoft® SQLServerAgent from executing the job according to that schedule. sp_update_jobschedule can be used to disable a scheduled job without removing it from the schedule.

SQL Server Enterprise Manager provides an easy, graphical way to manage jobs, and is the recommended way to create and manage the job infrastructure.

Permissions

Execute permissions default to the public role.

Examples

This example removes the Nightly Backup schedule from the Database Backup job.

USE msdb
EXEC sp_delete_jobschedule @job_name = N'Database Backup', 
   @name = N'Nightly Backup'

See Also

Modifying and Viewing Jobs

sp_add_jobschedule

sp_help_jobschedule

sp_update_jobschedule

System Stored Procedures