Posted By

pauliehaha on 09/10/09


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Beppoi


Trigger to Update Timestamp of Record when record updated


 / Published in: SQL
 

  1. CREATE TRIGGER dbo.myTable_Updated
  2. ON dbo.myTable
  3. FOR UPDATE
  4. AS
  5. BEGIN
  6. UPDATE dbo.myTable
  7. SET LastUpdated = CURRENT_TIMESTAMP
  8. WHERE Id IN
  9. (
  10. SELECT i.Id
  11. FROM inserted i
  12. );
  13. END
  14. GO

Report this snippet  

You need to login to post a comment.