Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2003
    Posts
    3

    Unanswered: Last Modified Field

    I'm creating a last modified field that I'll be putting into several of my tables in my current database and in many more to come so I want to get the most optimal way of doing this established so I don't end up propogating a problem. The field will be updated with the current time and date each time the row is modified. I created a trigger to do this, but I don't know if this is the best way. I'm not real experienced with MS SQL so I'm certainly open to suggestions. Here's the trigger code I have now.

    UPDATE s
    SET LastModified = getdate()
    FROM secUser s
    join inserted i on s.UID = i.UID

    Any suggestions would be appreciated.

    Thanks,
    Nate Baxley

  2. #2
    Join Date
    Dec 2002
    Location
    Czech Republic
    Posts
    249
    In this case, the best choice is instead of update trigger.

    Good luck!

Posting Permissions

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