Deletes a job.
sp_delete_job [ @job_id = ] job_id | [ @job_name = ] 'job_name'
[ , [ @originating_server = ] 'server' ]
[@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; both cannot be specified.
Return Code Values
0 (success) or 1 (failure)
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.
Anyone can delete jobs he owns. Only members of the sysadmin fixed server role can execute sp_delete_job to delete any job.
This example deletes the job Nightly Backups.
USE msdb EXEC sp_delete_job @job_name = 'Nightly Backups'