Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Who ran queries SQL 2008

Author  Topic 

SQLNOVICE999
Yak Posting Veteran

62 Posts

Posted - 2011-10-27 : 13:11:35
This is a script to find out what and who is running queries currently...


Select spid,hostname,program_name,nt_username,loginame,cmd, t.text from sys.sysprocesses
CROSS APPLY( select text from sys.dm_exec_sql_text(sql_handle))t

Is there something to find out all the queries that ran with USER logins in the past... I am using SQL 2008.

THanks,
Laura.

X002548
Not Just a Number

15586 Posts

Posted - 2011-10-27 : 14:28:33
who ran the LAST query

EDIT: YOu need to run a SQL Server Profiler Trace to track what's going on for a period of time...

OR

Only allow sproc access to the data, and log the sproc calls

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page
   

- Advertisement -