Last update on object?
November 4, 2011 Leave a comment
How many times do you wonder about when an object was last updated? You can find out by using the default sysobjects in SQL Server:
USE Adventureworks DECLARE @DBID INT = DB_ID('Adventureworks') SELECT o.name AS TableName, ddius.* FROM sys.dm_db_index_usage_stats ddius JOIN sys.objects o ON o.object_id = ddius.object_id WHERE database_id = @DBID ORDER BY ddius.last_user_update DESC
This will give you the last_user_update, which is based on indexes. The Insert, Delete or Update are stored in the sys properties of the database. So this only works if there is an index of some sort is used on the object!