我想知道被访问的前 N 个表。我只得到了数据库和谷歌地址中的大多数链接最后日期访问特定表。
SELECT DatabaseName, MAX(LastAccessDate) LastAccessDate
FROM
(SELECT
DB_NAME(database_id) DatabaseName
, last_user_seek
, last_user_scan
, last_user_lookup
, last_user_update
FROM sys.dm_db_index_usage_stats) AS PivotTable
UNPIVOT
(LastAccessDate FOR last_user_access IN
(last_user_seek
, last_user_scan
, last_user_lookup
, last_user_update)
) AS UnpivotTable
GROUP BY DatabaseName
HAVING DatabaseName NOT IN ('master', 'tempdb', 'model', 'msdb')
ORDER BY 2
现在我需要这个用于桌子。有什么想法或链接吗?