|
Hi!! There's a way to know when a view is accessed and which query is executed in SQL Server 2005/2008? Thanks for any help. P.S. Sorry for my english.
(comments are locked)
|
|
The best way to monitor what is being used to either set up a custom server-side trace to capture queries as they occur. You can also look at the default trace that's running on the server, but that's only going to have recent data available. Another option is to query the dynamic management function sys.dm_exec_sql_text. That will show you what's been running and is still in cache. Of the options, a custom server-side trace will give you the most direct control and flexibility. My second choice would be the DMV's. Grant is completely right, but be aware that the performance price of a server side trace can be quite high (depending of course on how close to maximum capacity the server is). One other option you may want to look at is giving them access to the view only through stored procedures. The stored procedure can then log its use as part of its execution. This brings with its own complications of course, but it could be a good trade off depending on your circumstances.
Nov 09 '09 at 01:58 PM
TimothyAWiseman
(comments are locked)
|

