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 :