| description | Create a User-Defined Event | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| title | Create a User-Defined Event | ||||||||||||
| ms.custom | seo-lt-2019 | ||||||||||||
| ms.date | 01/19/2017 | ||||||||||||
| ms.prod | sql | ||||||||||||
| ms.prod_service | sql-tools | ||||||||||||
| ms.technology | ssms | ||||||||||||
| ms.topic | conceptual | ||||||||||||
| helpviewer_keywords |
|
||||||||||||
| ms.assetid | 03d71a35-97fa-4bba-aa9a-23ac9c9cf879 | ||||||||||||
| author | markingmyname | ||||||||||||
| ms.author | maghan | ||||||||||||
| ms.reviewer | |||||||||||||
| monikerRange | = azuresqldb-mi-current || >= sql-server-2016 || = sqlallproducts-allversions |
[!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 [!INCLUDEssManStudioFull], 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