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 Administration
 Get History of Executed Commands

Author  Topic 

lesponce
Starting Member

8 Posts

Posted - 2013-07-12 : 12:53:21
How do I get a history of executed T-SQL Commands? I need run an audit for the last 3 months by Login Name. Using SQL, instead of products like Idera.

Also, how can I do that if the audit that I'm doing is for a linked server. Using the select openquery command?

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-07-12 : 14:34:55
Unless you have trace or CDC or something like that enabled, SQL Server does not keep a history of all the queries run against the server.
Go to Top of Page

lesponce
Starting Member

8 Posts

Posted - 2013-07-12 : 14:58:49
Thanks James.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-07-13 : 12:14:25
another way is to use profiler traces.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-07-13 : 17:49:05
You are very welcome.
Go to Top of Page
   

- Advertisement -