Bemærk
Adgang til denne side kræver godkendelse. Du kan prøve at logge på eller ændre mapper.
Adgang til denne side kræver godkendelse. Du kan prøve at ændre mapper.
Removes system records maintaining execution history for the referenced job.
Namespace: Microsoft.SqlServer.Management.Smo.Agent
Assembly: Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)
Syntax
'Declaration
Public Sub PurgeHistory
'Usage
Dim instance As Job
instance.PurgeHistory()
public void PurgeHistory()
public:
void PurgeHistory()
member PurgeHistory : unit -> unit
public function PurgeHistory()
Examples
The following code example deletes the execution history records of the "Test Job" job.
C#
Server srv = new Server("(local)");
Job jb = srv.JobServer.Jobs["Test Job"];
jb.PurgeHistory();
PowerShell
$srv = new-object Microsoft.SqlServer.Management.Smo.Server("(local)")
$jb = $srv.JobServer.Jobs["Test Job"]
$jb.PurgeHistory()
See Also
Reference
Microsoft.SqlServer.Management.Smo.Agent Namespace
Other Resources
Scheduling Automatic Administrative Tasks in SQL Server Agent