Logo 
Search:

SQL Server Articles

Submit Article
Home » Articles » SQL Server » Security FunctionsRSS Feeds

IS_MEMBER Function

Posted By: Sarita Patel     Category: SQL Server     Views: 3107

This article explains about IS_MEMBER function in sql server with examples.

IS_MEMBER indicates that the current user is a member of the specified Windows NT group or SQL Server role.

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.



Syntax of IS_MEMBER Function :

IS_MEMBER ( { 'group' | 'role' } )

group is a name of the Windows NT group. It must be in the format Domain\Group. It is a sysname.

role is a name of the SQL Server role. It is of type sysname. It can include the database fixed roles or user-defined roles but not server roles.

Return type of IS_MEMBER function is an integer. It returns 0 when current user is not a member of group or role, 1 when current user is a member of group or role and NULL when group or role is not valid..  




Examples of IS_MEMBER Function :

Example 1 : Use of IS_MEMBER function in select clause 

SELECT IS_MEMBER ('db_accessadmin')

Output
1

Above example returns 1 means logged in user is an admin user of northwind database. 
  
Share: 

 
 

Didn't find what you were looking for? Find more on IS_MEMBER Function Or get search suggestion and latest updates.

Sarita Patel
Sarita Patel author of IS_MEMBER Function is from United States.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!