Hey guys,
Good afternoon!

In this very quick post, I will show you the usefulness of the system view dm_exec_sessions, where we can query the sessions connected to our SQL Server instance.

How to identify users logged into the instance

SELECT 
    session_id,
    login_time,
    host_name,
    program_name,
    client_interface_name,
    login_name,
    status,
    cpu_time,
    memory_usage,
    last_request_start_time,
    last_request_end_time,
    transaction_isolation_level,
    lock_timeout,
    deadlock_priority
FROM 
    sys.dm_exec_sessions 
WHERE
    login_name NOT IN ('sa', 'AUTORIDADE NT\SISTEMA', 'NT AUTHORITY\SYSTEM')

Usuarios_Conectados
Users_Connected

That's it, folks!
Until later!