SQL Flow Field Guide

CURRENT_USER

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
sysname

Syntax at a glance

CURRENT_USER

Work example

Inspect the database user under the current execution context.

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

Check your work Use permission checks for access because module impersonation can change this name.

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