Bewerken

Delen via


jobs.sp_delete_job (Azure Elastic Jobs) (Transact-SQL)

Applies to: Azure SQL Database

Deletes an existing job in the Azure Elastic Jobs service for Azure SQL Database.

This stored procedure shares the name of sp_delete_job with a similar object in SQL Server for the SQL Server Agent service. For information about the SQL Server Agent version, see sp_delete_job.

Transact-SQL syntax conventions

Syntax

[jobs].sp_delete_job
    [ @job_name = ] N'job_name'
    [ , [ @force = ] force ]
[ ; ]

Arguments

[ @job_name = ] N'job_name'

The name of the job to be deleted. @job_name is nvarchar(128), with a default of NULL.

[ @force = ] force

Forces the job to be deleted. @force is bit.

  • When 1, forces the job to be deleted, even if executions are currently in progress, canceling any executions currently in progress.
  • When 0, fails if any job executions are in progress.

Return code values

0 (success) or 1 (failure).

Remarks

Job history is automatically deleted when a job is deleted.

To remove only a single job step from an existing job, use jobs.sp_delete_jobstep (Azure Elastic Jobs).

Permissions

By default, members of the sysadmin fixed server role can execute this stored procedure. Only members of sysadmin can use this stored procedure to edit the attributes of jobs owned by other users.