Created Date & Last Modified Date Triggers


/ Published in: SQL
Save to your folder(s)

First, create two new fields in your table "Created", and "LastModified" as "datetime" fields, being sure to allow nulls. Then run this code as a query to create triggers that will update the appropriate field when a record is modified, or a record is inserted. This proves very useful when you're dealing with a huge database.

In the code below replace [TableName] with your actual table name, and replace [UniqueID] with a unique ID field name in your table.

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.