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.
Author |
Topic |
gerek
Starting Member
3 Posts |
Posted - 2009-10-13 : 10:44:28
|
Hi,In SQL server how can i get all of the executed SQL s and their execution times (fow example all of the SQLs executed last week)?Thank you. |
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
Posted - 2009-10-13 : 12:14:38
|
You need to have been running a trace. That information is not stored by SQL. Google "SQL Trace" for info on setting one up.--Gail ShawSQL Server MVP |
 |
|
lionofdezert
Aged Yak Warrior
885 Posts |
Posted - 2009-10-15 : 05:39:54
|
http://connectsql.blogspot.com/2009/08/which-queries-to-pay-attention-to.html |
 |
|
gerek
Starting Member
3 Posts |
Posted - 2009-10-15 : 08:32:05
|
thanks a lot Gila |
 |
|
gerek
Starting Member
3 Posts |
Posted - 2009-10-15 : 08:32:54
|
and lionofdezertregards |
 |
|
shaggy
Posting Yak Master
248 Posts |
Posted - 2009-10-15 : 10:35:26
|
IF it is > 2005DMV -dynamic management view using this u can get the info (executed SQL s and their execution times) |
 |
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
Posted - 2009-10-15 : 11:48:52
|
quote: Originally posted by shaggy IF it is > 2005DMV -dynamic management view using this u can get the info (executed SQL s and their execution times)
If you're talking about sys.dm_exec_query_stats, that's only cumulative stats for the query since the plan was last put into the procedure cache. It only contains info on queries that are still in the procedure cache. It does not store info permanently and it's emptied by a restart of SQL.If not, which DMV are you thinking about?--Gail ShawSQL Server MVP |
 |
|
|
|
|