SELECT *
FROM master.dbo.sysprocesses sp
JOIN master.dbo.sysdatabases sd ON sp.dbid = sd.dbid
ORDER BY spid
go
SELECT
c.session_id,
c.net_transport,
s.host_name,
s.program_name,
s.nt_user_name,
c.connect_time,
s.client_interface_name,
c.client_net_address,
c.local_net_address,
s.login_name,
s.nt_domain,
s.login_time
FROM sys.dm_exec_connections AS c
JOIN sys.dm_exec_sessions AS s
ON c.session_id = s.session_id;
go
SELECT *
FROM sys.dm_exec_sessions
WHERE database_id > 0 -- OR 4 for user DBs
--GROUP BY database_id, login_name, status, host_name, program_name, nt_domain, nt_user_name;