Monday, February 16, 2026

Get Latest Active table Name

 Get the latest activity happed on which table name either insert, delete or update.


SELECT 

    t.name AS TableName,

    us.last_user_update

FROM 

    sys.dm_db_index_usage_stats AS us

INNER JOIN 

    sys.tables AS t ON t.object_id = us.object_id

WHERE 

    us.database_id = DB_ID()

ORDER BY 

    us.last_user_update DESC;

No comments:

Post a Comment