Creating an alert for a deleted row

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • der0
    New Member
    • Mar 2008
    • 4

    Creating an alert for a deleted row

    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?
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Originally posted by der0
    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

    Comment

    • der0
      New Member
      • Mar 2008
      • 4

      #3
      Originally posted by ck9663
      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?

      Comment

      • ck9663
        Recognized Expert Specialist
        • Jun 2007
        • 2878

        #4
        Yes a trigger would be the most logical choice. Every time the trigger fires, send yourself an email.

        -- CK

        Comment

        • der0
          New Member
          • Mar 2008
          • 4

          #5
          How would I do it though?

          Comment

          • der0
            New Member
            • Mar 2008
            • 4

            #6
            I tried this out but it wont send out a trigger

            CREATE TRIGGER tr_deleted_Cust omer1
            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

            Comment

            Working...