SQL Flow Field Guide

sys.sp_who

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

Provides information about current users, sessions, and processes in an instance of the SQL Server.

What changes

Input
Provides information about current users, sessions, and processes in an instance of the SQL Server.
Output or change
No write is stated in the Microsoft summary.

Syntax at a glance

sys.sp_who [ [ @loginame = ] { 'login' | *session_id* | 'ACTIVE' } ]
[ ; ]

Work example

Provides information about current users, sessions, and processes in an instance of the SQL Server.

Write a proposed call on paper. Name the target, required permission, expected change, and recovery step before any lab use.

Check your work Inspects the current session. Visibility of other sessions depends on server permissions. This procedure is retained for legacy monitoring.

Practice SQL

Open in SQL Flow

Open the SQL for a walkthrough. Run the example in SQL Server to check its result.

DECLARE @current_spid varchar(12) = CONVERT(varchar(12), @@SPID); EXEC master.sys.sp_who @loginame = @current_spid;

Open Microsoft Learn for full syntax, permissions, and details for your version.