The EnumNotifications method returns a QueryResults object enumerating notifications for a SQL Server Agent operator or alert.
Alert Object | Operator Object |
object.EnumNotifications( NotifyMethod, EnumNotifyType,
[ AlertOrOperator ] ) as QueryResults
Part | Description |
---|---|
object | Expression that evaluates to an object in the Applies To list. |
NotifyMethod | Long integer specifying a notification method and directing result set construction as described in Settings. |
EnumNotifyType | Long integer directing enumeration as described in Settings. |
AlertOrOperator | Optional. String specifying a notification target or source by name. When using the AlertOrOperator argument, the EnumNotifyType argument must specify SQLDMOEnumNotify_Target. |
The NotifyMethod argument is a bit-packed long integer. Use an Or to specify more than a single value. Set the NotifyMethod argument by using these values.
Constant | Value | Description |
---|---|---|
SQLDMONotify_All | 7 | Result set enumerates all notification methods. The use_email, use_pager, and use_netsend columns appear in the result set. |
SQLDMONotify_Email | 1 | Result set enumerates notification by e-mail. The use_email column appears in the result set. |
SQLDMONotify_NetSend | 4 | Result set enumerates notification by network popup message. The use_netsend column appears in the result set. |
SQLDMONotify_Pager | 2 | Result set enumerates notification by e-mail sent to the operator pager address. The use_pager column appears in the result set. |
Set the EnumNotifyType argument by using these values.
Constant | Value | Description |
---|---|---|
SQLDMOEnumNotify_Actual | 2 | Return only those operators or alerts configured for notification. |
SQLDMOEnumNotify_All | 1 | Return all operators or alerts. The value of the use_email, use_netsend, or use_pager column indicates that the operator or alert is configured for notification by the indicated method. |
SQLDMOEnumNotify_Max | 3 | SQLDMOEnumNotify_Target. |
SQLDMOEnumNotify_Min | 1 | SQLDMOEnumNotify_All. |
SQLDMOEnumNotify_Target | 3 | Return a result set enumerating notification for the operator or alert specified in the AlertOrOperator argument. |
For the Alert object, the EnumNotifications method returns a QueryResults object containing one result set defined by these columns.
Column | Data type | Description |
---|---|---|
operator_id | integer | System-generated operator identifier |
operator_name | nvarchar(129) | Operator name |
use_email | integer | Column present when NotifyMethod specifies SQLDMONotify_Email
When 1, the operator is configured to receive notification by e-mail |
use_pager | integer | Column present when NotifyMethod specifies SQLDMONotify_Pager
When 1, the operator is configured to receive notification by page |
use_netsend | integer | Column present when NotifyMethod specifies SQLDMONotify_NetSend
When 1, the operator is configured to receive notification by network popup message |
has_email | integer | When 1, the operator is configured with an e-mail address |
has_pager | integer | When 1, the operator is configured with a pager address |
has_netsend | integer | When 1, the operator is configured with an address for network popup message receipt |
For the Operator object, the EnumNotifications method returns a QueryResults object containing one result set defined by these columns.
Column | Data type | Description |
---|---|---|
alert_id | integer | System-generated alert identifier |
alert_name | nvarchar(129) | Alert name |
use_email | integer | Column present when NotifyMethod specifies SQLDMONotify_Email
When 1, the alert is configured to raise notification by e-mail |
use_pager | integer | Column present when NotifyMethod specifies SQLDMONotify_Pager
When 1, the alert is configured to raise notification by page |
use_netsend | integer | Column present when NotifyMethod specifies SQLDMONotify_NetSend
When 1, the alert is configured to raise notification by network popup message |
has_email | integer | When nonzero, the number of operators configured to receive alert notification by e-mail |
has_pager | integer | When nonzero, the number of operators configured to receive alert notification by pager |
has_netsend | integer | When nonzero, the number of operators configured to receive alert notification by network popup message |
HRESULT EnumNotifications(
SQLDMO_NOTIFY_TYPE NotifyMethod,
SQLDMO_ENUMNOTIFY_TYPE EnumNotifyType,
LPSQLDMOQUERYRESULTS *ppResults,
SQLDMO_LPCSTR AlertOrOperator = NULL);