SQL Flow Field Guide

IS_SRVROLEMEMBER

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
int Return value Description 0 login isn't a member of role. In Azure SQL Database, this statement always returns 0. 1 login is a member of role. NULL role or login isn't valid, or you don't have perm

Syntax at a glance

IS_SRVROLEMEMBER ( 'role' [ , 'login' ] )

Work example

Check membership in a fixed server role for the current login context.

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

Check your work Do not substitute it for object-level permissions or least privilege.

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