views:

82

answers:

3

How do I see the currently executing SQL statements in SQL Server? I've poked around in SQL Server Management Studio, but I don't see anything "canned".

+2  A: 

Profiler will log, and allow you to view, all activity on the server, if that's what you're looking for. http://msdn.microsoft.com/en-us/library/ms187929.aspx

Todd Ropog
just make sure you have permission to run profiler in sql server.http://msdn.microsoft.com/en-us/library/ms187611.aspx
SoftwareGeek
+2  A: 

The active connections can be listed with the built in stored procedures sp_who and sp_who2. At least one of them (don't remember which one right now) shows executing commands on the exact time when the sp is run.

As mentioned in another answer, sql server profiler is a great tool which gives much more detail and logging of activity. The sp:s just provides a quick overview.

Anders Abel
+1  A: 

Activity Monitor (in SSMS under Management) is a GUI version of sp_who2. To identify the T-SQL being executed, run DBCC Inputbuffer and the SPID, eg,

DBCC inputbuffer(54)
revelator