SQL Server Articles

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


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

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

HAS_DBACCESS returns information about whether the user has access to the specified database.

Syntax of HAS_DBACCESS Function :

HAS_DBACCESS ('database_name')

database_name specifies the name of database for which user wants access information. It is of type sysname.

Return type of HAS_DBACCESS is an integer. It returns 1 if the user has access to the database, 0 if the user has no access to the database, and NULL if the database name is invalid.

Examples of HAS_DBACCESS Function :

Example 1 : Use of HAS_DBACCESS function in select clause 



Above example returns 1 means logged in user has access to northwind database. 


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

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