Is there any way to determine if any table is in use or not by any project?
Of course question would be when table is only read-only; otherwise, I could see from
new inserted rows. Same question is for a stored procedure. SQL Server Profiler should probably help for SP, not sure about table.
But I don’t want to sit and observe SQL Server Profiler. I wish to have a kind of notification.
So basically, I would like to set up a trigger or something, if table gets hit, read then
it notifies me.
Thanks for your help
Without some form of planning ahead, I believe the answer is “No, you can’t determine usage with 100% accurarcy”.
The point is, SQL Server simply cannot know that such actions and activities might occur. You should be able to pick out 90%, 98%, or maybe 99.9% of all database activities, but if you need that 100% assurance that table dbo.LegacyDump is flat-out irrelevant junk, without having been in on the original design and implementation (and having total recall) you just can’t get to 100%.
When you get to that point, your best bet is to come up with a risk assessment (how bad might it be if we drop the table), a contingency plan (what to do if it turned out we should not have dropped that table), and documentation (so you or whoever can clearly recall the decisions made when it is found out you killed the system that calculates the C-level annual bonuses.)