Indicates whether the current user is a member of the specified Microsoft® Windows NT® group or Microsoft SQL Server™ role.
IS_MEMBER ({'group' | 'role' })
int
IS_MEMBER returns these values.
Return value | Description |
---|---|
0 | Current user is not a member of group or role. |
1 | Current user is a member of group or role. |
NULL | Either group or role is not valid. |
This function can be useful to programmatically detect whether the current user can perform an activity that depends on the permissions applied to a group or role.
This example indicates whether the current user is a member of the db_owner fixed database role.
IF IS_MEMBER ('db_owner') = 1
print 'Current user is a member of the db_owner role'
ELSE IF IS_MEMBER ('db_owner') = 0
print 'Current user is NOT a member of the db_owner role'
ELSE IF IS_MEMBER ('db_owner') IS NULL
print 'ERROR: Invalid group / role specified'
IS_SRVROLEMEMBER | Security Functions |