Redigera

Dela via


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

Applies to: Azure SQL Database

Updates a job created in the Azure Elastic Jobs service for Azure SQL Database.

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

Transact-SQL syntax conventions

Syntax

[jobs].sp_update_job [ @job_name = ] 'job_name'
  [ , [ @new_name = ] 'new_name' ]
  [ , [ @description = ] 'description' ]
  [ , [ @enabled = ] enabled ]
  [ , [ @schedule_interval_type = ] schedule_interval_type ]
  [ , [ @schedule_interval_count = ] schedule_interval_count ]
  [ , [ @schedule_start_time = ] schedule_start_time ]
  [ , [ @schedule_end_time = ] schedule_end_time ]

Arguments

@job_name

The name of the job to be updated. job_name is nvarchar(128).

@new_name

The new name of the job. new_name is nvarchar(128).

@description

The description of the job. The description argument is nvarchar(512).

@enabled

Specifies whether the job's schedule is enabled (1) or not enabled (0). @enabled is bit.

@schedule_interval_type

Value indicates when the job is to be executed. schedule_interval_type is nvarchar(50) and can be one of the following values:

  • 'Once',
  • 'Minutes',
  • 'Hours',
  • 'Days',
  • 'Weeks',
  • 'Months'

@schedule_interval_count

Number of schedule_interval_count periods to occur between each execution of the job. schedule_interval_count is int, with a default of 1. The value must be greater than or equal to 1.

@schedule_start_time

Date on which job execution can begin. schedule_start_time is DATETIME2, with the default of 0001-01-01 00:00:00.0000000.

All times in elastic jobs are in the UTC time zone.

@schedule_end_time

Date on which job execution can stop. schedule_end_time is DATETIME2, with the default of 9999-12-31 11:59:59.0000000.

All times in elastic jobs are in the UTC time zone.

Return code values

0 (success) or 1 (failure).

Remarks

After jobs.sp_add_job is executed to add a job, use jobs.sp_add_jobstep to add steps that perform the activities for the job.

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 that are owned by other users.