Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Another sp_who3

By Kristian Ask,

This script will use the standard sp_who2 to fill a temporary table with currently run processes rather than copying the code from that sp_who2 to my own.

The difference from others are that it is also getting the command being run by the process. Normally I know what database is using the resources but not the actual query being run.

Parameters to use are:

@SPID - process to show

@DBName - processes for this db only

@running - 1 for currently running processes, 0 for not running processes and null for all

@blocked - 1 for blocked processes, 0 for non-blocked processes and null for all

@eventinfo - like search on the SQL command being run


Feel free to use it...

Total article views: 4161 | Views in the last 30 days: 4
Related Articles

Blocked and Blocking process Help

Blocked and Blocking process Help


Blocked Processes

Find Percentage of blocked processes


Locks - Blocked Processes

Where to check for blocked processes in SQL Server ??





Using the Blocked Process Report in SQL Server 2005/2008

When excessive blocking occurs in SQL, performance degrades. Learn how to use the Blocked Process R...


Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones