Mistake #1: treating an operator as the alert itself. An operator is the configured recipient; an alert must still be linked to that operator before notification occurs. section 7.2
Database Mail must already be configured and must use an existing SMTP relay. Prefer a group address or distribution list over one person, and avoid deprecated pager notifications. section 7.2
Pete receives a database alert
Create the operator, then attach it to an alert. The example uses Pete for a duplicate-sales-order alert in the MagicChoc database; production systems should use a maintained group address. section 7.2
Listing 7.11 Creating a SQL Server Agent operator
EXEC msdb.dbo.sp_add_operator
@name= ‚Pete'
, @enabled=1
, @email_address= ‚pete@onehudredsqlmistakes.com' ;
Create an enabled SQL Server Agent operator with a Database Mail email address. section 7.2
Remember that SQL Server Agent alerts depend on events reaching the Windows application log. Raise custom errors with RAISERROR() WITH LOG when logging is required, even below severity 19. section 7.2
