Dela via


How to: Create an Alert Using an Error Number (SQL Server Management Studio)

This topic describes how to create a Microsoft SQL Server Agent alert that will be raised when an error of a specific number occurs.

To create an alert using an error number

  1. In Object Explorer, connect to an instance of the SQL Server Database Engine, and then expand that instance.

  2. Expand SQL Server Agent.

  3. Right-click Alerts and then click New Alert.

  4. In the Name box, enter a name for this alert.

  5. Check the Enable check box to enable the alert to run. By default, Enable is checked.

  6. In the Typebox, click SQL Server event alert.

  7. In the Database name list, select a database to restrict the alert to a specific database.

  8. Click Error number, and then type a valid error number for the alert.

  9. To restrict the alert to a particular character sequence, check the box corresponding to Raise alert when message contains, and enter a keyword or character string for the Message text. The maximum number of characters is 100.