Skip to content

Latest commit

 

History

History
76 lines (59 loc) · 3.24 KB

File metadata and controls

76 lines (59 loc) · 3.24 KB
title sp_remove_job_from_targets (Transact-SQL) | Microsoft Docs
ms.custom
ms.date 03/03/2017
ms.prod sql
ms.prod_service database-engine
ms.reviewer
ms.technology system-objects
ms.topic language-reference
f1_keywords
sp_remove_job_from_targets_TSQL
sp_remove_job_from_targets
dev_langs
TSQL
helpviewer_keywords
sp_remove_job_from_targets
ms.assetid b8171fb1-c11d-4244-8618-a12e28a150ce
author stevestein
ms.author sstein

sp_remove_job_from_targets (Transact-SQL)

[!INCLUDEtsql-appliesto-ss2008-xxxx-xxxx-xxx-md]

Removes the specified job from the given target servers or target server groups.

Topic link icon Transact-SQL Syntax Conventions

Syntax

  
sp_remove_job_from_targets [ @job_id = ] job_id   
     | [ @job_name = ] 'job_name'   
     [ , [ @target_server_groups = ] 'target_server_groups' ]   
     [ , [ @target_servers = ] 'target_servers' ]  

Arguments

[ @job_id = ] job_id The job identification number of the job from which to remove the specified target servers or target server groups. Either job_id or job_name must be specified, but both cannot be specified. job_id is uniqueidentifier, with a default of NULL.

[ @job_name = ] 'job_name' The name of the job from which to remove the specified target servers or target server groups. Either job_id or job_name must be specified, but both cannot be specified. job_name is sysname, with a default of NULL.

[ @target_server_groups = ] 'target_server_groups' 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.

[ @target_servers = ] 'target_servers' A comma-separated list of target servers to be removed from the specified job. target_servers is nvarchar(1024), with a default of NULL.

Return Code Values

0 (success) or 1 (failure)

Permissions

Permissions to execute this procedure default to members of the sysadmin fixed server role.

Examples

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  

See Also

sp_apply_job_to_targets (Transact-SQL)
sp_delete_jobserver (Transact-SQL)
System Stored Procedures (Transact-SQL)