Metodo Job.EnumHistory (JobHistoryFilter)

Enumerates a list of execution history associated with the referenced job.

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

Sintassi

'Dichiarazione
Public Function EnumHistory ( _
    filter As JobHistoryFilter _
) As DataTable
'Utilizzo
Dim instance As Job 
Dim filter As JobHistoryFilter 
Dim returnValue As DataTable 

returnValue = instance.EnumHistory(filter)
public DataTable EnumHistory(
    JobHistoryFilter filter
)
public:
DataTable^ EnumHistory(
    JobHistoryFilter^ filter
)
member EnumHistory : 
        filter:JobHistoryFilter -> DataTable
public function EnumHistory(
    filter : JobHistoryFilter
) : DataTable

Parametri

Valore restituito

Tipo: System.Data.DataTable
A DataTable object value that contains execution history data for the referenced job.

Esempi

The following code example creates a job then displays its filtered execution history.

C#

Server srv = new Server("(local)");
Job jb = srv.JobServer.Jobs["Test Job"];
JobHistoryFilter jhf = new JobHistoryFilter();
jhf.JobID = jb.JobID
DataTable jobHistory = jb.EnumHistory(jhf);

PowerShell

$srv = new-object Microsoft.SqlServer.Management.Smo.Server("(local)")
$jb = $srv.JobServer.Jobs["Test Job"]
$jhf = new-object Microsoft.SqlServer.Management.Smo.Agent.JobHistoryFilter
$jhf.JobID = $jb.JobID
$jobHistory = $jb.EnumHistory($jhf)

Vedere anche

Riferimento

Job Classe

Overload EnumHistory

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_help_job (Transact-SQL)