Skip to content

Latest commit

 

History

History
74 lines (52 loc) · 2 KB

File metadata and controls

74 lines (52 loc) · 2 KB
title sp_add_targetservergroup (Transact-SQL)
description Adds the specified server group.
author markingmyname
ms.author maghan
ms.reviewer randolphwest
ms.date 06/23/2025
ms.service sql
ms.subservice system-objects
ms.topic reference
f1_keywords
sp_add_targetservergroup
sp_add_targetservergroup_TSQL
helpviewer_keywords
sp_add_targetservergroup
dev_langs
TSQL

sp_add_targetservergroup (Transact-SQL)

[!INCLUDE SQL Server]

Adds the specified server group.

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

Syntax

sp_add_targetservergroup [ @name = ] 'name'
[ ; ]

Arguments

[ @name = ] 'name'

The name of the server group to create. @name is sysname, with no default. @name can't contain commas.

Return code values

0 (success) or 1 (failure).

Result set

None.

Remarks

Target server groups provide an easy way to target a job at a collection of target servers. For more information, see sp_apply_job_to_targets.

Permissions

[!INCLUDE msdb-execute-permissions]

Examples

The following example creates the target server group named Servers Processing Customer Orders.

USE msdb;
GO

EXECUTE dbo.sp_add_targetservergroup 'Servers Processing Customer Orders';
GO

Related content