SUSER_SNAME
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_SNAME ( [ server_user_sid ] )
Work example
Read the current or supplied server principal name.
Test under the intended execution context. Use GRANT and DENY rather than returned identity text.
Check your work A login name can differ from the database user and does not establish object permission.
Open Microsoft Learn for full syntax, permissions, and details for your version.