Freigeben über


RemoveFromTargetServer Method

Diese Funktion wird in zukünftigen Versionen von Microsoft SQL Server nicht mehr bereitgestellt. Verwenden Sie diese Funktion beim Entwickeln neuer Anwendungen nicht, und planen Sie das Ändern von Anwendungen, in denen es zurzeit verwendet wird.

The RemoveFromTargetServer method drops a single execution target for a SQL Server Agent job.

Syntax

object
.RemoveFromTargetServer(
Val
)

Parts

  • object
    Expression that evaluates to an object in the Applies To list.

  • Val
    String that specifies an instance of Microsoft SQL Server by name.

Prototype (C/C++)

HRESULT RemoveFromTargetServer(
SQLDMO_LPCSTR NewVal);

Hinweise

Before a SQL Server Agent job can execute, the job must have at least one step and an execution target.

When using SQL Distributed Management Objects (SQL-DMO) to create, schedule, and run SQL Server Agent jobs, use either the ApplyToTargetServer or ApplyToTargetServerGroup method to add an execution target. When a single execution target has been added by using the ApplyToTargetServer method, use the RemoveFromTargetServer method to remove the execution target.

When a job is targeted to run on the server running SQL Server Agent, specify the server name using the string (local) when removing the execution target.

HinweisHinweis

When an execution target is removed for a multiserver administration job, the master server posts an instruction to the target server indicating that the target server should drop its local copy of the job. The job is removed from the target server but remains defined at the master server. To completely remove a job from all servers participating in multiserver administration, use a job removing method such as the Remove method of the Job object or the RemoveJobByID method of the JobServer object.

Applies To: