Thursday, August 15, 2013

Server Busy? Who is there?

Server Busy? Who is there?


To see the connected session in your database use this SQL statement
SELECT HOSTNAME,
                 PROGRAM_NAME,
                STATUS,
                 SPID
FROM    MASTER..SYSPROCESSES
WHERE DBID= DB_ID('TestDB')
                AND SPID != @@SPID
It provide you the information like
Hose Name        --- The name of computer in case of multi user environment
Program_Name — The name of Application that use the SQL server
Status                ---  Whether it is active session or not
SPID                   — The id number by this you can kill the session