HAS_PERMS_BY_NAME
security context lookup
What changes
- Input
- security context (login, user, roles, permissions)
- Output or change
- name, id or boolean
- Return type
- int Returns NULL when the query fails.
Syntax at a glance
HAS_PERMS_BY_NAME ( securable , securable_class , permission [ , sub-securable ] [ , sub-securable_class ] )
Work example
Check effective permission for a named securable in the current context.
Test under the intended execution context. Use GRANT and DENY rather than returned identity text.
Check your work Use grants as the control and treat this check as contextual information.
Open Microsoft Learn for full syntax, permissions, and details for your version.