Trigger or Notification

  • Hi

    I want if record added/updated in particular table before a particular date i should get message or notification or email should go.

    Log should also get maintained of that entry

    Thanks

     

    • This topic was modified 2 years, 8 months ago by  jsshivalik.
  • That is a requirement. But what is your question?

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • Hi

    I want email should go and if date entered is < 30/03/2022 Below is the code

    CREATE TRIGGER dbo.TRG_Users_ChangeTracking

    ON dbo.Users

    AFTER INSERT

    AS

    BEGIN

    SET NOCOUNT ON;

    INSERT INTO ChangeTrackingHistory(UserID)

    SELECT i.UserID

    FROM inserted AS i;

    END

    GO

    Thanks

    • This reply was modified 2 years, 8 months ago by  jsshivalik.
  • sp_send_dbmail (link) will send an e-mail for you. But you still have not asked a question. Sample questions:

    • How do I send an e-mail in T-SQL?
    • How do I configure e-mail in SQL Server?
    • How do I select rows based on date?
    • etc etc

     

    • This reply was modified 2 years, 8 months ago by  Phil Parkin. Reason: Fix typo

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply