×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: T-SQL
Posted by: Loren Richter
Added: Sep 20, 2016 5:49 PM
Views: 10
Tags: database
Allows you to see when a table was last updated.
  1. SELECT DB_NAME(database_id) AS DatabaseName, OBJECT_NAME(OBJECT_ID) AS TableName, last_user_update,*
  2. FROM sys.dm_db_index_usage_stats
  3. WHERE 1=1
  4. and DB_NAME(database_id) LIKE ('Lorillard%')
  5. --and database_id = DB_ID('LorillardPreferenceEngine')
  6. --AND OBJECT_ID=OBJECT_ID('Person')
  7. and OBJECT_NAME(OBJECT_ID) IS NOT NULL
  8. ORDER BY sys.dm_db_index_usage_stats.last_user_update desc, OBJECT_NAME(OBJECT_ID)
  9.