Skip to main content

job_executions

Creates, updates, deletes, gets or lists a job_executions resource.

Overview

Namejob_executions
TypeResource
Idazure.sql.job_executions

Fields

The following fields are returned by SELECT queries:

Successfully retrieved the job.

NameDatatypeDescription
propertiesobjectResource properties.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectresourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, subscriptionIdGets a job execution.
list_by_jobselectresourceGroupName, serverName, jobAgentName, jobName, subscriptionIdcreateTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, $skip, $topLists a job's executions.
list_by_agentselectresourceGroupName, serverName, jobAgentName, subscriptionIdcreateTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, $skip, $topLists all executions in a job agent.
create_or_updateinsertresourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, subscriptionIdCreates or updates a job execution.
createinsertresourceGroupName, serverName, jobAgentName, jobName, subscriptionIdStarts an elastic job execution.
cancelexecresourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, subscriptionIdRequests cancellation of a job execution.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
jobAgentNamestringThe name of the job agent.
jobExecutionIdstring (uuid)The id of the job execution to cancel.
jobNamestringThe name of the job.
resourceGroupNamestringThe name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
serverNamestringThe name of the server.
subscriptionIdstringThe subscription ID that identifies an Azure subscription.
$skipintegerThe number of elements in the collection to skip.
$topintegerThe number of elements to return from the collection.
createTimeMaxstring (date-time)If specified, only job executions created before the specified time are included.
createTimeMinstring (date-time)If specified, only job executions created at or after the specified time are included.
endTimeMaxstring (date-time)If specified, only job executions completed before the specified time are included.
endTimeMinstring (date-time)If specified, only job executions completed at or after the specified time are included.
isActivebooleanIf specified, only active or only completed job executions are included.

SELECT examples

Gets a job execution.

SELECT
properties
FROM azure.sql.job_executions
WHERE resourceGroupName = '{{ resourceGroupName }}' -- required
AND serverName = '{{ serverName }}' -- required
AND jobAgentName = '{{ jobAgentName }}' -- required
AND jobName = '{{ jobName }}' -- required
AND jobExecutionId = '{{ jobExecutionId }}' -- required
AND subscriptionId = '{{ subscriptionId }}' -- required
;

INSERT examples

Creates or updates a job execution.

INSERT INTO azure.sql.job_executions (
resourceGroupName,
serverName,
jobAgentName,
jobName,
jobExecutionId,
subscriptionId
)
SELECT
'{{ resourceGroupName }}',
'{{ serverName }}',
'{{ jobAgentName }}',
'{{ jobName }}',
'{{ jobExecutionId }}',
'{{ subscriptionId }}'
RETURNING
properties
;

Lifecycle Methods

Requests cancellation of a job execution.

EXEC azure.sql.job_executions.cancel 
@resourceGroupName='{{ resourceGroupName }}' --required,
@serverName='{{ serverName }}' --required,
@jobAgentName='{{ jobAgentName }}' --required,
@jobName='{{ jobName }}' --required,
@jobExecutionId='{{ jobExecutionId }}' --required,
@subscriptionId='{{ subscriptionId }}' --required
;