查看客户端的IP地址,机器名,MAC地址,登陆名等信息
SELECT s.session_id,s.login_time,s.host_name,p.loginame,s.program_name,c.client_net_address,c.client_tcp_port
,p.net_address as client_mac_address, c.local_net_address,c.local_tcp_port,c.net_transport
FROM sys.dm_exec_connections c
JOIN sys.dm_exec_sessions s ON c.session_id = s.session_id
JOIN sys.sysprocesses p ON s.session_id = p.spid
select host_name,client_net_address from #t group by host_name,client_net_address
drop table #t