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:

    1. get sessionid user:

      exec sp_who;

    1. 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

Popular posts from this blog

android - Automated my builds -

how to proxy from https to http with lighttpd -

python - Flask migration error -