Compartilhar via


Método Job.PurgeHistory

Removes system records maintaining execution history for the referenced job.

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

Sintaxe

'Declaração
Public Sub PurgeHistory
'Uso
Dim instance As Job

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

Exemplos

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

Consulte também

Referência

Job Classe

Namespace Microsoft.SqlServer.Management.Smo.Agent

Outros recursos

Agendando tarefas administrativas automáticas no SQL Server Agent

Tarefas de administração automatizadas (SQL Server Agent)

sp_purge_jobhistory (Transact-SQL)