Skip to content

Latest commit

 

History

History
78 lines (55 loc) · 2.87 KB

sp-add-target-group-elastic-jobs-transact-sql.md

File metadata and controls

78 lines (55 loc) · 2.87 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs monikerRange
jobs.sp_add_target_group (Azure Elastic Jobs) (Transact-SQL)
jobs.sp_add_target_group creates a target group for jobs in the Azure Elastic Jobs service for Azure SQL Database.
WilliamDAssafMSFT
wiassaf
08/21/2024
azure-sql-database
system-objects
reference
sp_add_target_group_TSQL
sp_add_target_group
jobs.sp_add_target_group_TSQL
jobs.sp_add_target_group
sp_add_target_group
jobs.sp_add_target_group
TSQL
=azuresqldb-current

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

[!INCLUDE Azure SQL Database]

Creates a target group for jobs in the Azure Elastic Jobs service for Azure SQL Database.

Target groups provide an easy way to target a job at a collection of servers and/or databases.

:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions

Syntax

[jobs].sp_add_target_group
 @target_group_name = 'target_group_name'
[ , [ @target_group_id = ] target_group_id OUTPUT ]

Arguments

@target_group_name

The name of the target group to create. target_group_name is nvarchar(128), with no default.

@target_group_id OUTPUT

The target group identification number assigned to the job if created successfully. target_group_id is an output variable of type uniqueidentifier, with a default of NULL.

Return code values

0 (success) or 1 (failure).

Remarks

Use jobs.sp_add_target_group_member to add members to a target group.

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.

Examples

Create a target group

The following example creates a target group named ServerGroup1.

-- Add a target group containing server(s)
EXEC [jobs].sp_add_target_group @target_group_name = N'ServerGroup1';

Related content