sp_delete_jobschedule (T-SQL)

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, but 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 SQL Server Agent 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_update_jobschedule
sp_add_jobschedule System Stored Procedures
sp_help_jobschedule  

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.