Yashwant
Yashwant

Reputation: 61

List All Tables Modified in Last N Days

How to get the list of all tables modified in the last N days?

Upvotes: 1

Views: 2836

Answers (2)

David Brabant
David Brabant

Reputation: 43499

If this is for data, you can use a query like:

exec sp_MSforeachtable 'SELECT OBJECT_NAME(OBJECT_ID) AS DatabaseName, last_user_update,*
FROM sys.dm_db_index_usage_stats
WHERE database_id = DB_ID(''<yourDataBaseNameHere>'')
AND OBJECT_ID=OBJECT_ID(''?'')'

and filter the result for the date range you are interested in. See latt_user_updates column.

Upvotes: 3

Related Questions