Results 1 to 4 of 4

Thread: how to write trigger based on certain condition

  1. #1
    Join Date
    Jul 2005
    Posts
    9

    how to write trigger based on certain condition

    One of my table called as 'customertable' contains following fields

    customername, emailid, subscriptionendperiod

    Example records are:

    david, david@john.com, 12/20/2005(mm/dd/yyyy format).

    My question is that: Just one month before subscriptionendperiod that is on 11/20/2005(mm/dd/yyyy) an automatic email should go to david@john.com with the message 'Your subscription period ends on 12/20/2005'

    How to write trigger for this.

    Please Note : No ASP code is invloved in this.
    Only MSSQL coding to be done.


    Regards

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    A trigger can only be fired on a DML, so you can't get it to trigger based on current date. You can write a stored procedure and run that every day.

  3. #3
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    You have to schedule a job and a run the proc daily.

  4. #4
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    oops. Sailesh said the same thing. Ignore.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •