The Dynamic Management View (DMV) sys.dm_db_index_usage_stats can be used to find out the counts of different types of index operations and the time each type of operation was last performed. This view counts every individual seek, scan, lookup or update on the specified object caused by user-submitted queires or by internally generated queries, such as scan for gathering statistics. The counters are initialized to empty whenever the SQL Server (MSSQLSERVER) service is started. In addition, whenever a database is detached or is shut down (for example, because AUTO_CLOSE is set to ON), all rows associated with the database are removed.
Permissions : Requires VIEW SERVER STATE permission.
/* Cretate Test Table */
CREATE TABLE SampleTest
/* Insert data into test table - This will refect in DMV counter */
INSERT INTO SampleTest
SELECT 1, 'First'
SELECT 2, 'Second'
/* Query to Find out Last Activity on SQL Objects (such as Tables, Views) */
SELECT OBJECT_NAME(OBJECT_ID) AS ObjectName
,DB_NAME(DATABASE_ID) AS DatabaseName
WHERE DATABASE_ID = DB_ID( 'Test')
AND OBJECT_ID = OBJECT_ID('SampleTest')