Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Alerts do not work for Error Numbers - Why

Author  Topic 

DBADave
Constraint Violating Yak Guru

366 Posts

Posted - 2007-08-06 : 10:05:16
I'm unable to get an alert to fire for Error 2627, Primary Key Violation. I have followed BOL's instructions for creating an alert, which appears to be nearly identical to 2000, however the alert will not work. I can see the error number in a Profiler trace along with the Severity number. I've also tried creating alerts for other error numbers and had the same result. The BOL instructions are as follows:

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 Type box, 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

What am I doing wrong?

Thanks, Dave

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-08-06 : 12:29:05
Did you set alert response?
Go to Top of Page

DBADave
Constraint Violating Yak Guru

366 Posts

Posted - 2007-08-06 : 13:20:19
Not yet. I wanted to make sure it detected the alert, but the alert history continues to report 0 occurrences.
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-08-06 : 16:27:22
Did the event ever happen in the db?
Go to Top of Page

DBADave
Constraint Violating Yak Guru

366 Posts

Posted - 2007-08-06 : 16:30:40
Yes. I created a table with a primary key and forced a primary key violation. I receive the following error.

Msg 2627, Level 14, State 1, Line 2
Violation of PRIMARY KEY constraint 'PK_DBA1'. Cannot insert duplicate key in object 'dbo.DBA1'.
The statement has been terminated.

I was able to create an alert for Severity 14 and that worked, but still no luck on 2627. Any idea?

Thanks, Dave
Go to Top of Page
   

- Advertisement -