SQL Server query to show active/current connections to the SQL instance.

select getdate() as RunDate,
    db_name(sp.dbid) as DBName,
    rtrim(cast(@@servername as varchar(100))) as Server,
    sp.spid,
    sp.blocked,
    sp.waittime,
    sb.name,
    sp.lastwaittype,
    sp.cpu,
    sp.login_time,
    sp.last_batch,
    sp.status,
    sp.hostname,
    sp.program_name,
    sp.cmd,
    sp.loginame,
    getdate() - sp.last_batch as duration
from master..sysprocesses as sp
inner join master..sysdatabases as sb
    on sp.dbid = sb.dbid;