sp_delete_job (T-SQL)

Deletes a job.

Syntax

sp_delete_job [@job_id =] job_id | [@job_name =] 'job_name'
    [, [@originating_server =] 'server']

Arguments
[@job_id =] job_id
Is the identification number of the job to be deleted. job_id is uniqueidentifier, with a default of NULL.
[@job_name =] 'job_name'
Is the name of the job to be deleted. job_name is sysname, with a default of NULL.

Note Either job_id or job_name must be specified, but both cannot be specified.


Return Code Values

0 (success) or 1 (failure)

Result Sets

None

Remarks

Two parameters, @delete_history and @originating_server, exist in sp_delete_job, but are reserved for internal use.

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

Only members of the sysadmin fixed server role or the db_owner fixed database role can execute sp_delete_job.

Examples

This example deletes the job Nightly Backups.

USE msdb

EXEC sp_delete_job @job_name ='Nightly Backups'

  

See Also
sp_add_job sp_update_job
sp_help_job System Stored Procedures

  


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