How to capture queries run by a specific user in SQL Server -
messed sql sentry, guess done trace well. recommended ways watch/log queries of particular user? logging anytime run it. i.e. if ran @ night?
try use sql server system functions: execution related dynamic management views , functions (transact-sql)http://msdn.microsoft.com/en-us/library/ms188068.aspx
for example:
get sessionid user:
exec sp_who;
use this:
select a.session_id, st.text querytext sys.dm_exec_connections cross apply sys.dm_exec_sql_text(a.most_recent_sql_handle) st a.session_id = sessionid;
Comments
Post a Comment