The AddNotification method associates operators with alerts. Operators designated receive notification messages when an event raising the alert occurs.
Alert Object | Operator Object |
object.AddNotification( str, NotificationType )
Part | Description |
---|---|
object | Expression that evaluates to an object in the Applies To list |
str | String specifying a SQL Server Agent operator or alert by name |
NotificationType | Long integer specifying a method for notification message delivery as described in Settings |
The NotificationType argument is a bit-packed, long integer value. Specify more than a single notification method by combining values using an Or.
Constant | Value | Description |
---|---|---|
SQLDMONotify_All | 7 | Notify using e-mail, e-mail sent to the pager address, and network popup message. |
SQLDMONotify_Email | 1 | Notify by e-mail sent to the operator e-mail address. |
SQLDMONotify_NetSend | 4 | Notify by network popup message posted to the operator network address. |
SQLDMONotify_None | 0 | No notification method specified for the referenced operator. Use to disable notification of an operator. |
SQLDMONotify_Pager | 2 | Notify by e-mail sent to the operator pager address. |
The AddNotification method can be used to add an alert to the list of alerts that generate operator notification, or an operator to the list of those notified when the alert is raised.
For the Alert object, the str argument identifies an operator. For the Operator object, str identifies an alert.
HRESULT AddNotification(
SQLDMO_LPCSTR strAlertOrOperator,
SQLDMO_NOTIFY_TYPE NotifyMethod);