How to Check when a Table was Last Updated
Please read our Disclaimer
Works With
-Microsoft SQL Server 2016 (RTM) – 13.0.1601.5 (X64)
-Microsoft SQL Server 2008 (RTM) – 10.0.1600.22 (X64)
Command:
SELECT OBJECT_NAME(OBJECT_ID) AS DatabaseName, last_user_update, * FROM sys.dm_db_index_usage_stats WHERE database_id = DB_ID(‘[replace with your database name]’) AND OBJECT_ID = OBJECT_ID(‘[replace with your table name]’)
Steps and Sample Usage:
- Open and log into your SQL Management Studio
- Open a New Query Windows or (CTRL+N)
- Copy and Paste the code block above to your Query Window
- Replace the DB_ID with the name of your Database and replace the OBJECT_ID with the name of your Table
- Execute the query by pressing F5.
Sample Data:
-AdventureWorks2016 Database