Метод Job.EnumAlerts
Enumerates a list of Agent alerts that cause automated execution of the referenced job.
Пространство имен: Microsoft.SqlServer.Management.Smo.Agent
Сборка: Microsoft.SqlServer.Smo (в Microsoft.SqlServer.Smo.dll)
Синтаксис
'Декларация
Public Function EnumAlerts As DataTable
'Применение
Dim instance As Job
Dim returnValue As DataTable
returnValue = instance.EnumAlerts()
public DataTable EnumAlerts()
public:
DataTable^ EnumAlerts()
member EnumAlerts : unit -> DataTable
public function EnumAlerts() : DataTable
Возвращаемое значение
Тип: System.Data.DataTable
A DataTable object value that contains a table of information about the alerts that cause automated execution of the job.
Примеры
The following code example creates an alert that causes the automated execution of a job, then uses the EnumAlerts method to display its information.
C#
Server srv = new Server("(local)");
Job jb = new Job(srv.JobServer, "jobName");
jb.Create();
jb.ApplyToTargetServer(srv.Name);
Alert al = new Alert(srv.JobServer, "Test Alert");
al.Severity = 17;
al.JobID = jb.JobID;
al.Create()
jb.Refresh()
DataTable alertTable = jb.EnumAlerts()
PowerShell
$jb = new-object Microsoft.SqlServer.Management.Smo.Agent.Job($srv.JobServer, "Test Job23")
$jb.Create()
$jb.ApplyToTargetServer($srv.Name)
$al = new-object Microsoft.SqlServer.Management.Smo.Agent.Alert($srv.JobServer, "Test Alert23")
$al.Severity = 17
$al.JobID = $jb.JobID
$al.Create()
$jb.Refresh()
$alertTable = $jb.EnumAlerts()
См. также
Справочник
Пространство имен Microsoft.SqlServer.Management.Smo.Agent
Другие ресурсы
Задачи автоматизированного администрирования (агент SQL Server)
Планирование автоматических административных задач в агенте SQL Server