Job.Parent 属性

Gets or sets the JobServer object that is the parent of the Job object.

命名空间:  Microsoft.SqlServer.Management.Smo.Agent
程序集:  Microsoft.SqlServer.Smo(在 Microsoft.SqlServer.Smo.dll 中)

语法

声明
<SfcObjectAttribute(SfcObjectRelationship.ParentObject)> _
Public Property Parent As JobServer 
    Get 
    Set
用法
Dim instance As Job 
Dim value As JobServer 

value = instance.Parent

instance.Parent = value
[SfcObjectAttribute(SfcObjectRelationship.ParentObject)]
public JobServer Parent { get; set; }
[SfcObjectAttribute(SfcObjectRelationship::ParentObject)]
public:
property JobServer^ Parent {
    JobServer^ get ();
    void set (JobServer^ value);
}
[<SfcObjectAttribute(SfcObjectRelationship.ParentObject)>]
member Parent : JobServer with get, set
function get Parent () : JobServer 
function set Parent (value : JobServer)

属性值

类型:Microsoft.SqlServer.Management.Smo.Agent.JobServer
A JobServer object value that specifies the parent of the Job object.

注释

The JobServer object represents the Microsoft SQL Server Agent running on the instance of SQL Server.

示例

The following code example sets the name and parent of a job, then creates it.

C#

Server srv = new Server("(local)");
Job jb = new Job();
jb.Name = "Test Job";
jb.Parent = srv.JobServer;
jb.Create();

PowerShell

$srv = new-object Microsoft.SqlServer.Management.Smo.Server("(local)")
$jb = new-object Microsoft.SqlServer.Management.Smo.Agent.Job
$jb.Name = "Test Job"
$jb.Parent = $srv.JobServer
$jb.Create()

请参阅

参考

Job 类

Microsoft.SqlServer.Management.Smo.Agent 命名空间

其他资源

自动执行管理任务(SQL Server 代理)

sp_add_job (Transact-SQL)

在 SQL Server 代理中计划自动管理任务