sp_delete_job (Transact-SQL)
Deletes a job.
The @originating_server argument is reserved for internal use.
The @delete_unused_schedule argument provides backward compatibility with previous versions of SQL Server by automatically removing schedules that are not attached to any job. Notice that this parameter defaults to the backward-compatible behavior. To retain schedules that are not attached to a job, you must provide the value 0 as the @delete_unused_schedule argument.
SQL Server Management Studio provides an easy, graphical way to manage jobs, and is the recommended way to create and manage the job infrastructure.
This stored procedure cannot delete maintenance plans, and cannot delete jobs that are part of maintenance plans. Instead, use SQL Server Management Studio to delete maintenance plans.
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:
-
SQLAgentUserRole
-
SQLAgentReaderRole
-
SQLAgentOperatorRole
For details about the permissions of these roles, see SQL Server Agent Fixed Database Roles.
Members of the sysadmin fixed server role can execute sp_delete_job to delete any job. A user that is not a member of the sysadmin fixed server role can only delete jobs owned by that user.

Note