Modify the Target Servers for a Job
This topic describes how to change the target servers for Microsoft SQL Server Agent jobs in SQL Server 2012 by using SQL Server Management Studio or Transact-SQL.
In This Topic
Before you begin:
Security
To modify the target servers for a job, using:
SQL Server Management Studio
Transact-SQL
Before You Begin
Security
Permissions
By default, members of the sysadmin fixed server role can execute this stored procedure. Other users must be granted one of the following SQL Server Agent fixed database roles in the msdb database:
SQLAgentUserRole
SQLAgentReaderRole
SQLAgentOperatorRole
[Top]
Using SQL Server Management Studio
To modify the target servers for a job
In Object Explorer, connect to an instance of the SQL Server Database Engine, and then expand that instance.
Expand SQL Server Agent, expand Jobs, right-click a job, and then click Properties.
In the Job Properties dialog, select the Targetspage, and click Target local server, or Target multiple servers.
If you choose Target multiple servers, designate the servers that will be targets for the job by checking the box to the left of the server name. Verify that the check boxes for servers that will not be targets of the job are unchecked.
[Top]
Using Transact-SQL
To modify the target servers for a job
Connect to the Database Engine.
From the Standard bar, click New Query.
Copy and paste the following example into the query window and click Execute. This example assigns the multiserver job Weekly Sales Backups to the server SEATTLE2.
USE msdb ;
GO
EXEC dbo.sp_add_jobserver
@job_name = N'Weekly Sales Backups',
@server_name = N'SEATTLE2' ;
GO
For more information, see sp_add_jobserver (Transact-SQL).
[Top]