SQL Server: How to know when a table has been queried

I am working with a database which exists off a commercial product.  It has "Group" tables that are populated when users add groups via the front end, and they may use their own groups or groups that other users have made.  I have a large client who would like to remove unused groups.  Nothing changes in the tables when the groups are being used.

Triggers don't work on the "select" command.  Is there a way that I may add something (back-end only, sadly) that would keep track of when a group was used?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

This probably isn't going to be easy to do.  You can setup a profiler trace, but as far as I know you can't specify a specific table that you are looking for.  A table could be referenced by a stored procedure or function.  You would need a list of every object that references the table and then compare that to the profiler trace and see who executed it.  That would be a monumental task.  

But I have an easier solution.  Disable, not delete, the accounts in question and see who screams.  Crude, but probably more effective.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
You Can use SQL Profiler for tracing tables activity such as selects, inserts, deletes and updates.
-- remember to Apply filters like
    1) on Group table names
    2) dbid -- target database

Review the trc output by querying through TSQL function:
FROM fn_trace_gettable(‘D:\SQLTrace\TraceGrouptableAccessFile.trc’, default) Trace

Vinod Pottekkatt
jruheAuthor Commented:
Thanks guys.  Both have value.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.