Skip to content

Latest commit

 

History

History
79 lines (54 loc) · 4.35 KB

create-a-user-defined-event.md

File metadata and controls

79 lines (54 loc) · 4.35 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic helpviewer_keywords monikerRange
Create a User-Defined Event
Create a User-Defined Event
markingmyname
maghan
01/19/2017
sql
ssms
how-to
SQL Server Agent alerts, user-defined events
user-defined events [SQL Server]
multiple language support [SQL Server], alerts
languages [SQL Server], alerts
severity levels [SQL Server]
global considerations [SQL Server], alerts
events [SQL Server], user-defined
SQL Server Agent alerts, multiple-language environments
alerts [SQL Server], user-defined events
alerts [SQL Server], multiple-language environments
custom events [SQL Server Agent]
international considerations [SQL Server], alerts
= azuresqldb-mi-current || >= sql-server-2016

Create a User-Defined Event

[!INCLUDE SQL Server SQL MI]

Important

On Azure SQL Managed Instance, most, but not all SQL Server Agent features are currently supported. See Azure SQL Managed Instance T-SQL differences from SQL Server for details.

You can create user-defined events if you want to monitor events other than events that are predefined by [!INCLUDEssNoVersion]. You can also assign a severity level to each user-defined event.

Note

When using SQL Server Management Studio, select the Write to Windows application event log option for each user-defined event message, to ensure that the messages are logged. By default, user-defined messages of severity lower than 19 are not sent to the [!INCLUDEmsCoName] Windows application log when they occur. User-defined messages of severity lower than 19 therefore do not trigger SQL Server Agent alerts.

User-defined events must have a unique message number. Message numbers for a user-defined event must be greater than 50,000. You can define messages for the event in multiple languages. However, an En-US error message must exist before messages in other languages can be added.

If you administer a multiple-language [!INCLUDEssNoVersion] environment, create user-defined messages in each of the languages that are supported. For example, if you are creating a new event message to be used on both an English and a German server, use the same message number and severity for both, but assign a different language to each.

The following tasks provide information about how to create user-defined events and alerts that respond to them:

To create an alert based on a message number

To create an alert based on severity levels

To define the response to an alert

To create a user-defined event error message

To modify a user-defined event error message

To delete a user-defined event error message

To disable or reactivate an alert

See Also

sp_update_alert (Transact-SQL)