Saturday, 11 May 2013

When was my table last scanned or updated?


When was my table last scanned or updated?
Hi i am posting a blog related to how to check when your table last updated or scanned. This issue occurred when more than one person work on same project and some some mistakenly changed by anyone.

USE DatabaseName  ----your database name--
GO
SELECT
t.name,
i.last_user_lookup,
i.last_user_scan,
i.last_user_seek,
i.last_user_update
FROM sys.dm_db_index_usage_stats i
INNER JOIN sys.tables t
ON i.object_id = t.object_id
WHERE
database_id = db_id( 'DatabaseName' )  ----your database name--

No comments:

Post a Comment