News

Copyright © 2008-2018 Paula DiTallo

Tag Cloud



SQL SERVER: How do I find all the tables that have had an update in a database?

This query will bring back the last user update to every table in the database you're connected to.


use [dbname]
go

SELECT last_user_update, 
t.name 
FROM sys.dm_db_index_usage_stats us 
JOIN sys.tables t 
ON t.object_id = us.object_id 
WHERE database_id = db_id()
and cast(last_user_update as date) >= cast('2018-05-09' as date)
order by last_user_update desc
Wednesday, May 9, 2018 11:27 AM

Feedback

No comments posted yet.


Post A Comment
Title:
Name:
Email:
Comment:
Verification: