Skip to content

SQL Find Last Update/Lookup Times For All Tables In Database

May 8, 2012
SELECT	OBJECT_NAME(OBJECT_ID) AS tablename, last_user_update, last_user_seek, last_user_scan, last_user_lookup,
		last_system_scan, user_scans, user_seeks, user_lookups, user_updates, system_seeks, system_scans, system_lookups,
		system_updates
FROM	sys.dm_db_index_usage_stats
WHERE	database_id = DB_ID('DatabaseName')
		AND OBJECT_ID IN ( SELECT	object_id
						   FROM		sys.Tables )
Advertisements

From → SQL

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: