By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,363 Members | 2,473 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,363 IT Pros & Developers. It's quick & easy.

Creating an alert for a deleted row

P: 4
Hello,

I am just learning how to use SQL Server 2000 and I want to create an alert in which I delete a row from a table and I receive an alert notifying me that the row has been deleted. Can anyone help?
Mar 26 '08 #1
Share this Question
Share on Google+
5 Replies


ck9663
Expert 2.5K+
P: 2,878
Hello,

I am just learning how to use SQL Server 2000 and I want to create an alert in which I delete a row from a table and I receive an alert notifying me that the row has been deleted. Can anyone help?

What kind of alert?

-- CK
Mar 26 '08 #2

P: 4
What kind of alert?

-- CK
I guess it needs to be more of a trigger than an alert. I created a custom db with a table that has client numbers on it. To test it I want to delete a clients information and have a trigger notify me that the table information has been altered. I did a little more reading the other night and I saw something on the ADD,INSERT, DELETE trigger. Any suggestions?
Mar 27 '08 #3

ck9663
Expert 2.5K+
P: 2,878
Yes a trigger would be the most logical choice. Every time the trigger fires, send yourself an email.

-- CK
Mar 27 '08 #4

P: 4
How would I do it though?
Mar 28 '08 #5

P: 4
I tried this out but it wont send out a trigger

CREATE TRIGGER tr_deleted_Customer1
ON Customer
AFTER DELETE
AS

--Advise whose been deleted
IF EXISTS (SELECT * FROM deleted WHERE [Customer Number] = 'A-Z')
BEGIN
DECLARE @Count nvarchar
PRINT CAST(@Count as varchar(3))+' row(s) were deleted '
END
go
Mar 28 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.