SQL Server Who Lock

When working with SQL Server, two procedures that I use from time to time is sp_who and sp_lock. The sp_who procedure provides information as to which loginame, hostname, dbname are for current users. Usually I am just interested the activity on a given user, which you can use the following SQL command.

sp_who @loginame = 'sa'

The sp_lock procedure reports on which sessions ids are locked in the database. There are different level of locks such as database, table, and data locks.

Technorati Tags: , , , , , ,