Check SQL connections

Login to SQL Management Studio, select Master database and click on New Query and paste the below code :
CREATE TABLE #sp_who2
    (SPID INT,

    Status VARCHAR(1000) NULL,
    Login SYSNAME NULL,
    HostName SYSNAME NULL,
    BlkBy SYSNAME NULL,
    DBName SYSNAME NULL,
    Command VARCHAR(1000) NULL,
    CPUTime INT NULL,
    DiskIO INT NULL,
    LastBatch VARCHAR(1000) NULL,
    ProgramName VARCHAR(1000) NULL,
    SPID2 INT,
    RequestID INT)  
GO
INSERT INTO #sp_who2
EXEC sp_who2
GO
SELECT Login, DBName, count(Login) AS Connections
FROM #sp_who2
GROUP BY Login, DBName
ORDER BY Connections DESC
GO
DROP TABLE #sp_who2
GO

Click on Execute button, and it will show the current connections to the SQL database server.
That’s it…

About Sarath

A Techie from Kochi, India with 8+ years of experience in Linux and Windows server administration. I learn new things almost everyday and I enjoy the fun of learning and sharing my knowledge.

Related Posts

COMMENTS

Leave a Reply

Your email address will not be published. Required fields are marked *