When Were My Tables Last Updated?

This short query lets you know when your user tables were last updated. This can be handy for dropping old tables and data not required any more. It’s important to remember that the data comes from DMVs and so are reset every time SQL Server is restarted so if you were to run this query shortly after SQL Server has been restarted, the tables will hold no data regarding when tables were last updated.

SELECT OBJECT_NAME(OBJECT_ID) AS TABLEName, db_name(database_id) AS Database_Name, last_user_lookup, last_user_seek, last_user_scan, last_user_update
FROM sys.dm_db_index_usage_stats
WHERE object_id IN
(SELECT object_id
FROM sys.objects
WHERE TYPE = 'u')
ORDER BY last_user_update, Database_Name