I often use sp_who and sp_who2 to see who is connected to what on our development database server. When we need to restore a database, I need to make sure no one else is connected and sp_who is a quick way to get that information. The annoying part is that it displays every connection to every database, you can’t filter by database. Vyas Kondreddi wrote a decent version that he named sp_who_3. It does pretty much what sp_who does, exception it takes lots of optional parameters that let you filter the data. I tweaked his code a little bit, but it’s good stuff.
Technorati Tags: SQL Server sp_who DBA