Checking active connections in MSSQL
Let’s check the number of active connections per program in Microsoft SQL Server.
SELECT PROGRAM_NAME, HOSTNAME, STATUS, COUNT(DBID) AS NumberOfConnections
FROM sys.sysprocesses
WHERE PROGRAM_NAME = 'program name (ex: node-mssql)'
GROUP BY PROGRAM_NAME, HOSTNAME, STATUS;
Reference: https://docs.microsoft.com/en-us/sql/relational-databases/system-compatibility-views/sys-sysprocesses-transact-sql?view=sql-server-2017
Leave a comment