Created
May 25, 2017 09:01
-
-
Save Patricy/b47664d4b34c5579ebb9e1754b894c62 to your computer and use it in GitHub Desktop.
Last access to the table TABLENAME in SQLServer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| select DB_NAME(us.[database_id]) as [db], OBJECT_NAME(us.[object_id], us.[database_id]) as [object], | |
| MAX(us.[last_user_lookup]) as [last_user_lookup], MAX(us.[last_user_scan]) as [last_user_scan], MAX(us.[last_user_seek]) as [last_user_seek] | |
| from sys.dm_db_index_usage_stats as us | |
| where us.[database_id] = DB_ID() AND us.[object_id] = OBJECT_ID('TABLENAME') | |
| group by us.[database_id], us.[object_id]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment