ORIGINAL_LOGIN
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
ORIGINAL_LOGIN( )
Work example
Read the login that opened a session before execution-context changes.
Test under the intended execution context. Use GRANT and DENY rather than returned identity text.
Check your work Compare with SUSER_SNAME only for diagnostics and never expose the result as a secret.
Open Microsoft Learn for full syntax, permissions, and details for your version.