Who is connected to your server with SQL Server?
Microsoft SQL Server keeps track of the who is connected, when they connected...
How many users are connected?
select count(*) as 'Total Connections' from sysprocesses where hostname<>''; go
Total Connections ----------------- 2 (1 row(s) affected)
Who is connected and when
select login_time as 'Login',
last_batch as 'Batch',
cast(status as varchar(12)) as 'Status',
cast(hostname as varchar(18)) as 'Host',
cast(program_name as varchar(32)) as 'Program',
cast(cmd as varchar(24)) as 'Command',
cast(nt_username as varchar(18)) as 'User',
cast(loginame as varchar(24)) as 'Login'
from sysprocesses
WHERE hostname<>''
order by nt_username;
go
Login Batch Status Host Program Command User Login ----------------------- ----------------------- ------------ ------------------ -------------------------------- ------------------------ ------------------ ------------------------ 2007-06-15 08:29:18.653 2007-06-15 08:29:21.310 sleeping SQLSERVER Microsoft SQL Server Management AWAITING COMMAND froggy SQLSERVER\froggy 2007-06-15 08:29:27.357 2007-06-15 08:50:33.310 runnable SQLSERVER Microsoft SQL Server Management SELECT froggy SQLSERVER\froggy (2 row(s) affected)

