SQL Server Articles

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


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

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

IS_SRVROLEMEMBER is used to check the current user login is a member of the specified server role.

This function can be useful to programmatically detect whether the current user can perform an activity requiring the server role's permissions.

Syntax of IS_SRVROLEMEMBER Function :

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

role is a name of the server role. It is a sysname.

login is an optional name of the logged in user. It is a sysname. If you don't specify, the current user login account is used.  

Return type of IS_SRVROLEMEMBER is an integer. It returns 1 when login is a member of role, 0 when login is not a member of role and NULL when role or login is not valid.

Examples of IS_SRVROLEMEMBER Function :

Example 1 : Use of IS_SRVROLEMEMBER function in select clause 



Above example returns 1 means logged in user is a server admin user of northwind database. 


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

Sarita Patel
Sarita Patel author of IS_SRVROLEMEMBER 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!