How do I see active SQL Server connections?

后端 未结 8 949
暖寄归人
暖寄归人 2020-11-28 00:13

I am using SQL Server 2008 Enterprise. I want to see any active SQL Server connections, and the related information of all the connections, like from which IP address, conne

8条回答
  •  忘掉有多难
    2020-11-28 00:53

    SELECT 
        DB_NAME(dbid) as DBName, 
        COUNT(dbid) as NumberOfConnections,
        loginame as LoginName
    FROM
        sys.sysprocesses
    WHERE 
        dbid > 0
    GROUP BY 
        dbid, loginame
    ;
    

    See also the Microsoft documentation for sys.sysprocesses.

提交回复
热议问题