Created
August 20, 2018 23:09
-
-
Save JCKodel/1cfe5c7a9b08347d51246d8c96a936a1 to your computer and use it in GitHub Desktop.
Obtendo a última data de alteração de cada tabela
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 | |
q.tableName | |
,MAX(q.lastUpdate) AS lastUpdate | |
FROM | |
( | |
SELECT | |
s.name + '.' + t.name AS tableName | |
,ISNULL(u.last_user_update, '2000-01-01') AS lastUpdate | |
FROM sys.tables AS t | |
INNER JOIN sys.schemas AS s ON s.schema_id = t.schema_id | |
LEFT JOIN sys.dm_db_index_usage_stats AS u ON u.object_id = t.object_id | |
) q | |
GROUP BY q.tableName |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment