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 |
|
|
|
=azuresqldb-current |
[!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
[jobs].sp_add_target_group
@target_group_name = 'target_group_name'
[ , [ @target_group_id = ] target_group_id OUTPUT ]
The name of the target group to create. target_group_name is nvarchar(128), with no default.
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
.
0
(success) or 1
(failure).
Use jobs.sp_add_target_group_member to add members to a target group.
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.
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';