Sunday, March 3, 2013

SQL SERVER – Last Date Time Updated for Any Table


Query provides details of when was  the table last updated. Without WHERE Condition it will provide details of the entire database.

SELECT OBJECT_NAME(OBJECT_ID) AS DatabaseName, last_user_update,*
FROM sys.dm_db_index_usage_stats
WHERE database_id = DB_ID( 'DatabaseName')
AND OBJECT_ID=OBJECT_ID('TableName')

Note: In WHERE class replace DatabaseName & TableName with your Database and Table name.

No comments: