One of the applications I work with has more than 900 tables, so as you can imagine trying to determine where the data lives can sometimes be difficult.
This script shows me which tables were updated by the last transaction.
USE [DB Name] -- Must set the DB context
GO
SELECT OBJECT_NAME(s.object_id) AS ObjectName , s.last_user_update , s.*
FROM sys.dm_db_index_usage_stats s
WHERE database_id = DB_ID() -- Current DB ID
ORDER BY s.last_user_update DESC;
Add the database name in the USE and run after committing the transaction.
Make note of the time so that you can tell your transaction from others.
One thought on “Identifying which tables are updated by a transaction”
Thanks heaps for this, it really helped me find where the data I wanted was.