Wednesday, October 19, 2011

Who is there?

Today I needed to take a database offline. Generally we send notification to all requesting to log off. But today I thought to do something differently. Before I send notification to everyone I wanted to see if anyone is using that database at all.

There are a system stored procedure sp_who which returns information regarding current sessions on given database.

There is an extended version of this stored procedure is also available.