How do I find which tables are being inserted to? Is there a DMV for that in SQL Server?
In Microsoft SQL Server 2008, how do I find whi开发者_StackOverflow中文版ch tables are being inserted to? Is there a DMV for that?
SQL Server Profiler:
http://msdn.microsoft.com/en-us/library/ms187929.aspx
In theory, all tables can be inserted into -- depending on access.
I think you're really after SQL Server Audit functionality...
sys.dm_db_index_usage_stats
. The one(s) that have the user_updates
increased between consecutive checks have seen updates ('updates' in general: inserts, deletes or value updates).
A more detailed view is offered by sys.dm_db_index_operational_stats
which can differentiate between the inserts and deletes and between operations occurring at leaf level or at non-leaf level, but such level of detail may be overkill if you only try to find out which tables in your database are still 'used' and which ones are 'dead code'.
Both tables maintain the counts only since last database startup so you need to run a representative load first to get an accurate picture.
精彩评论