how to find out what SQL commands were executed last three days?

greenspun.com : LUSENET : SQL Server Database Administration : One Thread

I need to find out what SQL commands were executed for the last 3 days. Is there a way to see the history of all SQL commands which were executed in the database? Thank you, Sasha

-- Anonymous, January 25, 2005

Answers

Sasha,

I don't know of a good way to do this retroactively, but for the future you can use SQL Profiler to run a trace which includes events such as:

Stored Procedures.RPC:Completed Stored Procedures.SP:Completed Stored Procedures.Stmt:Completed TSQL.SQL:BatchCompleted TSQL.SQL:StmtCompleted

Hope this helps,

Eric

-- Anonymous, January 25, 2005


Moderation questions? read the FAQ