ApplyToTargetServer Method (SQL-DMO)

The ApplyToTargetServer method adds an execution target to the list of targets maintained for the referenced SQL Server Agent job.

Applies To

Job Object

Syntax

object.ApplyToTargetServer( str )

Part Description
object Expression that evaluates to an object in the Applies To list
str String specifying by name a single Microsoft® SQL Server™ installation

Remarks

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

When using 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 job will run on the server running SQL Server Agent, use the ApplyToTargetServer method to target the job, specifying the server using the string (local).

Prototype (C/C++)

HRESULT ApplyToTargetServer(SQLDMO_LPCSTR NewValue);

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.