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
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Past queries

Author  Topic 

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2007-10-09 : 11:05:28
Is there an option is SQL Server or SSMS to view the past few already executed queries.

I need to check what are all the queries fired on SQL server.




------------------------
I think, therefore I am - Rene Descartes

Kristen
Test

22859 Posts

Posted - 2007-10-09 : 11:11:39
Don't think so, but SQL Profiler can do that

Kristen
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-10-09 : 11:21:46
this might be of some help...
http://weblogs.sqlteam.com/mladenp/archive/2007/09/20/SSMS-Tools-Pack---an-add-in-for-SQL-Management-Studio.aspx

however it's not server based. it's client based.

also this might be of some help:

select creation_time, execution_count, total_worker_time, total_logical_reads,
total_elapsed_time, query_plan, TEXT
FROM sys.dm_exec_query_stats qs
cross apply sys.dm_exec_query_plan(qs.plan_handle) qp
cross apply sys.dm_exec_sql_text(qs.sql_handle) st


_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com
Go to Top of Page

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2007-10-09 : 12:08:15
Thank you Spirit1. That's what I was looking for.

------------------------
I think, therefore I am - Rene Descartes
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-10-09 : 12:10:03
the first or the second?

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com
Go to Top of Page

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2007-10-09 : 12:14:27
I checked the second code it worked for me. I am reading the first article now...

------------------------
I think, therefore I am - Rene Descartes
Go to Top of Page

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2007-10-09 : 12:22:45
I even check the GUI, it works. Great!

------------------------
I think, therefore I am - Rene Descartes
Go to Top of Page
   

- Advertisement -