How to Create an Alert in SQL Server - Microsoft SQL Server DBA Tutorial

In this video you will learn how to create alert in SQL Server using SQL Server management studio as well using T-SQL Script. It walks you through different types of Alerts in SQL Server, how to configure severity settings, how to configure error message search, how to configure Response and configuring different options while creating alert in SQL Server. It also talks about best practices of creating SQL Server Alert using SQL Server Agent.

Script to Create Alert in SQL Server

USE [msdb]
GO
EXEC msdb.dbo.sp_add_alert @name=N'JobStatus_DBA', 
        @message_id=0, 
        @severity=10, 
        @enabled=1, 
        @delay_between_responses=1800, 
        @include_event_description_in=1, 
        @notification_message=N'Job failed on Production System (SQLMirror)', 
        @event_description_keyword=N'Job Failed', 
        @job_id=N'00000000-0000-0000-0000-000000000000'
GO

Create an Alert in SQL Server - Microsoft SQL Server DBA Tutorial