IS_ROLEMEMBER
security context lookup
What changes
- Input
- security context (login, user, roles, permissions)
- Output or change
- name, id or boolean
- Return type
- int Return value Description 0 database_principal isn't a member of role. 1 database_principal is a member of role. NULL database_principal or role isn't valid, or you don't have permission to view th
Syntax at a glance
IS_ROLEMEMBER ( 'role' [ , 'database_principal' ] )
Work example
Check whether a database principal belongs to a database role.
Test under the intended execution context. Use GRANT and DENY rather than returned identity text.
Check your work Supply the intended role and member and verify nested group behavior.
Open Microsoft Learn for full syntax, permissions, and details for your version.