# MsSQL 2005 or 2008 Show number of connections

**URL:** <https://forums.thehomestack.io/t/mssql-2005-or-2008-show-number-of-connections/4847>\
**Category:** Databases\
**Created:** [March 17, 2013, 3:16pm UTC](https://forums.thehomestack.io/t/mssql-2005-or-2008-show-number-of-connections/4847 "2013-03-17T15:16:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![steve.ling](https://forums.thehomestack.io/letter_avatar_proxy/v4/letter/s/d6d6ee/32.png) [@steve.ling](https://forums.thehomestack.io/u/steve.ling)\
**Post date:** [March 17, 2013, 3:16pm UTC](https://forums.thehomestack.io/t/mssql-2005-or-2008-show-number-of-connections/4847/1 "2013-03-17T15:16:01Z")

</div>

This shows the number of connections per each DB:

```auto

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

```

And this gives the total:

```auto

SELECT COUNT(dbid) as TotalConnections FROM sys.sysprocesses WHERE dbid > 0

```

If you need more detail, run:

```auto

sp_who2 'Active'

```
