Thursday, May 04, 2006

SQL Server 2000 : sp_who

While going through an article on System.Transactions came accross this SP, and in no time, could identify this old friend of mine. This SP helped us to solve an issue related to database connections in my previous project(a point of sale system).

Click to Enlarge

The sp_who internal procedure allows users to view current activity on the database. This provides a view into several system tables (e.g., syslocks, sysprocesses, etc.).

Spid—The system process ID.
status—The status of the process.
loginame—Login name of the user.
hostname—Machine name of the user.
blk—If the process is getting blocked, this value is the SPID of the blocking process.
dbname—Name of database the process is using.
Cmd—The command currently being executed.

sp_who2 provides more details than this.

Following is another alternative way..

select spid,program_name,status,dbid,cmd
from master.dbo.sysprocesses

No comments:

Post a Comment