Defining Alerts

Errors and messages, or events, are generated by Microsoft® SQL Server™ and entered into the Microsoft Windows NT® application log. SQL Server Agent reads the application log and compares events to alerts that you have defined. When SQL Server Agent finds a match, it fires an alert.

By default, the following SQL Server events are logged in the Windows NT application log:


Note Make sure that the Windows NT application log is of sufficient size to avoid losing SQL Server event information.


Alerts must be defined before notifications can be sent. The primary attributes of an alert are name and event or performance condition specification.

Naming an Alert

Every alert must have a name. Alert names must be unique and can be no longer than 128 characters.

Selecting an Event

You can specify an alert to occur in response to one or more events. You specify the set of events to trigger an alert according to:

Selecting a Performance Condition

You can specify a performance condition to monitor by firing an alert when the performance threshold is reached. To set a performance condition you must define the following:

Creating a User-defined Event Message

You can create user-defined event messages if you have special event tracking needs that are not addressed by standard SQL Server event messages. User-defined event messages generate error numbers greater than 50000. Additionally, you can assign them a severity level.

User-defined event messages must be unique and have a unique error number and unique language.


Note When using SQL Server Enterprise Manager, you should select the Write to Windows NT application event log option. By default, user-defined messages with severities less than 19 are not sent to the Windows NT application log when they occur and therefore do not trigger SQL Server Agent alerts.


If you administer a multiple language SQL Server environment, you should create user-defined messages in each of the languages you support. For example, if you are creating a new event message that will be used on both an English and a German server, use the same event number for both, but assign a different language for each.

To create an alert using an error number

         

To create an alert using severity level

         

To define the response to an alert

         

To create a user-defined event error message

    

To edit a user-defined event error message

    

To delete a user-defined event error message

    

To disable or reactivate an alert

         

See Also

xp_logevent

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.