Show Active Connection in MS SQL

A sql script for showing the active connection for the current Microsoft SQL Server.
created by on 2008-03-26
SELECT Substring(Db_name(dbid), 1, 30) AS DB_name,
       Count(*)                        AS Connection
FROM   sysprocesses
GROUP  BY Substring(Db_name(dbid), 1, 30)
Tags:
Fork allmark on GitHub