views:

390

answers:

4

I am new to SQL Server Management Studio and am wondering if there is a way to see what queries have been ran against a database. Surely there is a way to see these. In the Activity monitor, there is a "Recent Expensive Queries" but I'm guessing that isn't all of the queries since I'm not seeing the ones I have ran. I am running SQL Server 2008 v 10.0.1600.22.

+2  A: 

Use SQL Profiler and use a filter on it to get the most expensive queries.

Benjamin Ortuzar
I forgot to mention this is SQL Server Express. From reading other posts, it looks like Profiler isn't included in Express. Is that still correct?
bsh152s
Yes, it is only included with Enterprise, Standard, and Workgroup editions. You can compare this and other features here: http://www.microsoft.com/sqlserver/2008/en/us/editions-compare.aspx
Benjamin Ortuzar
A: 

You need a SQL profiler, which actually runs outside SQL Management Studio. If you have a paid version of SQL Server (like the developer edition), it should be included in that as another utility.

If you're using a free edition (SQL Express), they have freeware profiles that you can download. I've used AnjLab's profiler (available at http://sites.google.com/site/sqlprofiler), and it seemed to work well.

Mike Mooney
A: 

In use the Activity Monitor. It's the last toolbar in the top bar. It will show you a list of "Recent Expensive Queries". You can double-click them to see the execution plan, etc.

John Saunders
+1  A: 

If you want SSMS to maintain a query history, use the SSMS Tool Pack add on.

If you want to monitor the SQL Server for currently running queries, use SQL PRofiler as other have already suggested.

Remus Rusanu