Partager via


EnumNotifications Method

Cette fonctionnalité sera supprimée dans une prochaine version de Microsoft SQL Server. Évitez d'utiliser cette fonctionnalité dans de nouveaux travaux de développement et prévoyez de modifier les applications qui utilisent actuellement cette fonctionnalité.

The EnumNotifications method returns a QueryResults object that enumerates notifications for a Microsoft SQL Server Agent operator or alert.

Syntaxe

object.EnumNotifications(NotifyMethod ,EnumNotifyType ,
[ AlertOrOperator ] ) as QueryResults

Parts

  • object
    Expression that evaluates to an object in the Applies To list.

  • NotifyMethod
    Long integer that specifies a notification method and directing result set construction as described in Settings.

  • EnumNotifyType
    Long integer that directs enumeration as described in Settings.

  • AlertOrOperator
    Optional. String that specifies a notification target or source by name. When using the AlertOrOperator argument, the EnumNotifyType argument must specify SQLDMOEnumNotify_Target.

Prototype (C/C++)

HRESULT EnumNotifications(
SQLDMO_NOTIFY_TYPE NotifyMethod,
SQLDMO_ENUMNOTIFY_TYPE EnumNotifyType,
LPSQLDMOQUERYRESULTS *ppResults,
SQLDMO_LPCSTR AlertOrOperator = NULL);

Settings

The NotifyMethod argument is a bit-packed long integer. Use an OR logical operator to specify more than a single value. Set the NotifyMethod argument using these values.

Constant

Value

Description

SQLDMONotify_All

7

Notification by e-mail, e-mail sent to the pager address, and network pop-up message.

SQLDMONotify_Email

1

Notification by e-mail sent to the operator e-mail address.

SQLDMONotify_NetSend

4

Notification by network pop-up message posted to the operator network address.

SQLDMONotify_Pager

2

Notification by e-mail sent to the operator pager address.

Set the EnumNotifyType argument 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 that enumerates notification for the operator or alert specified in the AlertOrOperator argument.

Returns

For the Alert object, the EnumNotifications method returns a QueryResults object that contains one result set defined by these columns.

Column

Data type

Description

has_email

integer

When 1, the operator is configured with an e-mail address.

has_netsend

integer

When 1, the operator is configured with an address for network pop-up message receipt.

has_pager

integer

When 1, the operator is configured with a pager address.

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_netsend

integer

Column present when NotifyMethod specifies SQLDMONotify_NetSend.

When 1, the operator is configured to receive notification by network pop-up message.

use_pager

integer

Column present when NotifyMethod specifies SQLDMONotify_Pager.

When 1, the operator is configured to receive notification by page.

For the Operator object, the EnumNotifications method returns a QueryResults object that contains one result set defined by these columns.

Column

Data type

Description

alert_id

integer

System-generated alert identifier.

alert_name

nvarchar(129)

Alert name.

has_email

integer

When nonzero, the number of operators configured to receive alert notification by e-mail.

has_netsend

integer

When nonzero, the number of operators configured to receive alert notification by network pop-up message.

has_pager

integer

When nonzero, the number of operators configured to receive alert notification by pager.

use_email

integer

Column present when NotifyMethod specifies SQLDMONotify_Email.

When 1, the alert is configured to raise notification by e-mail.

use_netsend

integer

Column present when NotifyMethod specifies SQLDMONotify_NetSend.

When 1, the alert is configured to raise notification by network pop-up message.

use_pager

integer

Column present when NotifyMethod specifies SQLDMONotify_Pager.

When 1, the alert is configured to raise notification by page.