Freigeben über


Job.Rename-Methode

Renames the job.

Namespace:  Microsoft.SqlServer.Management.Smo.Agent
Assembly:  Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)

Syntax

'Declaration
Public Sub Rename ( _
    newName As String _
)
'Usage
Dim instance As Job 
Dim newName As String

instance.Rename(newName)
public void Rename(
    string newName
)
public:
virtual void Rename(
    String^ newName
) sealed
abstract Rename : 
        newName:string -> unit  
override Rename : 
        newName:string -> unit
public final function Rename(
    newName : String
)

Parameter

Implementiert

IRenamable.Rename(String)

Beispiele

The following code example demonstrates how to rename a job.

C#

Server srv = new Server("(local)");
Job jb = new Job(srv.JobServer, "Test Job");
jb.ApplyToTargetServer(srv.Name);
jb.Rename("New Job Name");

PowerShell

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

Siehe auch

Verweis

Job Klasse

Microsoft.SqlServer.Management.Smo.Agent-Namespace

Andere Ressourcen

Planen von automatischen, administrativen Tasks im SQL Server-Agent

Automatisierte Administrationstasks (SQL Server-Agent)

sp_update_job (Transact-SQL)