Partager via


Méthode Job.PurgeHistory

Removes system records maintaining execution history for the referenced job.

Espace de noms :  Microsoft.SqlServer.Management.Smo.Agent
Assembly :  Microsoft.SqlServer.Smo (en Microsoft.SqlServer.Smo.dll)

Syntaxe

'Déclaration
Public Sub PurgeHistory
'Utilisation
Dim instance As Job

instance.PurgeHistory()
public void PurgeHistory()
public:
void PurgeHistory()
member PurgeHistory : unit -> unit
public function PurgeHistory()

Exemples

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()

Voir aussi

Référence

Job Classe

Espace de noms Microsoft.SqlServer.Management.Smo.Agent

Autres ressources

Planification des tâches administratives automatiques dans l'Agent SQL Server

Tâches d'administration automatisée (Agent SQL Server)

sp_purge_jobhistory (Transact-SQL)