SQL Flow Field Guide

SUSER_NAME

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

security context lookup

What changes

Input
security context (login, user, roles, permissions)
Output or change
name, id or boolean
Return type
nvarchar(128)

Syntax at a glance

SUSER_NAME ( [ server_user_id ] )

Work example

Resolve a server principal id to its visible login name.

Test under the intended execution context. Use GRANT and DENY rather than returned identity text.

Check your work Treat the name as display metadata and not proof of authorization.

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