#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Philadephia
    Posts
    16
    Rep Power
    0

    Cool How can I fire up a SP when a field is updated/changed


    Good afternoon,
    Database="ncos"
    I have a table with a fields named "unique_id","Status","Status_Updated","Op_Won"

    What I am looking for is a stored procedure to update the datetime field "Status_Updated" when the field "Status" gets changed.

    Also, if the field "Status" gets changed to "Won" then I would like to populate the field "Op_Won" with the current datetime.

    Any ideas...and thanks in advance.
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    2
    Rep Power
    0
    Good afternoon bholmstrom,

    I don't know if you solved your problem, but this is my solution : use trigger, and the SQL NOW() function

    Add a trigger on your table. You can specify when you want it to go off. In your case, during the Status's modification, so an UpDate query. Trigger will run every time you run an Update query on this table.
    In order to put the current date in Status_Updated's column, use SQL Now() which return the current system date and time.

    A stored-procedure is not using for this work.

IMN logo majestic logo threadwatch logo seochat tools logo