How do I add a “last updated” column in a SQL Server 2008 R2 table?

To know which row was last updated, you need to create a new column of type DATETIME/DATETIME2 and update it with a trigger. There is no data type that automatically updates itself with date/time information every time the row is updated. To avoid recursion you can use the UPDATE() clause inside the trigger, e.g. ALTER … Read more