Condividi tramite


Metodo Job.DeleteJobStepLogs (DateTime)

Deletes job step log files that are older than the specified date.

Spazio dei nomi  Microsoft.SqlServer.Management.Smo.Agent
Assembly:  Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)

Sintassi

'Dichiarazione
Public Sub DeleteJobStepLogs ( _
    olderThan As DateTime _
)
'Utilizzo
Dim instance As Job 
Dim olderThan As DateTime

instance.DeleteJobStepLogs(olderThan)
public void DeleteJobStepLogs(
    DateTime olderThan
)
public:
void DeleteJobStepLogs(
    DateTime olderThan
)
member DeleteJobStepLogs : 
        olderThan:DateTime -> unit
public function DeleteJobStepLogs(
    olderThan : DateTime
)

Parametri

  • olderThan
    Tipo: System.DateTime
    A DateTime value that specifies the log date, after which to delete the job step log files.

Esempi

The following code example deletes all job step log files that were created after March 15th, 2009.

C#

Server srv = new Server("(local)");
Job jb = srv.JobServer.Jobs["Test Job"];
DateTime deleteDate = new DateTime(2009, 3, 15, 9, 45, 52);
jb.DeleteJobStepLogs(deleteDate);

PowerShell

$srv = new-object Microsoft.SqlServer.Management.Smo.Server("(local)")
$jb = $srv.JobServer.Jobs["Test Job"]
$deleteDate = new-object System.DateTime(2009, 3, 15)
$jb.DeleteJobStepLogs($deleteDate)

Vedere anche

Riferimento

Job Classe

Overload DeleteJobStepLogs

Spazio dei nomi Microsoft.SqlServer.Management.Smo.Agent

Altre risorse

Pianificazione delle attività amministrative automatiche in SQL Server Agent

Automatizzazione delle attività amministrative (SQL Server Agent)

sp_delete_jobsteplog (Transact-SQL)