title | description | author | ms.author | ms.reviewer | ms.date | ms.service | ms.subservice | ms.topic | f1_keywords | helpviewer_keywords | dev_langs | ||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sp_remove_job_from_targets (Transact-SQL) |
sp_remove_job_from_targets removes the specified job from the given target servers or target server groups. |
markingmyname |
maghan |
randolphwest |
08/22/2024 |
sql |
system-objects |
reference |
|
|
|
[!INCLUDE SQL Server]
Removes the specified job from the given target servers or target server groups.
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions
sp_remove_job_from_targets
[ [ @job_id = ] 'job_id' ]
[ , [ @job_name = ] N'job_name' ]
[ , [ @target_server_groups = ] N'target_server_groups' ]
[ , [ @target_servers = ] N'target_servers' ]
[ ; ]
The job identification number of the job from which to remove the specified target servers or target server groups. @job_id is uniqueidentifier, with a default of NULL
.
Either @job_id or @job_name must be specified, but both can't be specified.
The name of the job from which to remove the specified target servers or target server groups. @job_name is sysname, with a default of NULL
.
Either @job_id or @job_name must be specified, but both can't be specified.
A comma-separated list of target server groups to be removed from the specified job. @target_server_groups is nvarchar(1024), with a default of NULL
.
A comma-separated list of target servers to be removed from the specified job. @target_servers is nvarchar(1024), with a default of NULL
.
0
(success) or 1
(failure).
Permissions to execute this procedure default to members of the sysadmin fixed server role.
The following example removes the previously created Weekly Sales Backups
job from the Servers Processing Customer Orders
target server group, and from the SEATTLE1
and SEATTLE2
servers.
USE msdb;
GO
EXEC dbo.sp_remove_job_from_targets
@job_name = N'Weekly Sales Backups',
@target_server_groups = N'Servers Processing Customer Orders',
@target_servers = N'SEATTLE2,SEATTLE1';
GO