Who2 wants to process sp_who2 ?

SP_who2 has become a very handy tool for administrator, DBAs developers or all who are the All-In-One role) to get information from the processes table and get the appropriate information by just issuing this command form the command line. Easy if you have <100 connections and go simply through the data by scrolling and getting the appropriate information with a quick view, but tedious for those having hundreds of connections which come for different applications, hostnames, database names etc.

If you already got familiar with the concepts of the dynamic management views (DMVs and DMFs) you might recognize some of the information from the relevant runtime views like

  • sys.dm_exec_sessions
  • sys.dm_exec_requests
  • sys.dm_exec_sql_text(sql_handle)

So making it easy for you moving away from the sp_who2 to the “new” features (Yes, I know that they are around since 2005, but I saw many people not being aware of this incredible insight in the engine), I created a hybrid solution which should make it easy for you to change your way of querying this data and give you a good start for getting your feet wet.

I really encourage you to use this DMV to discover information you might not yet have insights to.

-Jens

PS: Also have a look at the *drumm roll* DMV - All stars form Jimmy May (he has a blog!)

GetInformationFromSP_who2.sql