HAS_DBACCESS
Returns information about whether the user has access to the specified database.
Syntax
HAS_DBACCESS ( 'database_name' )
Arguments
'database_name'
The name of the database for which the user wants access information. database_name is sysname.
Return types
int
Examples
SELECT HAS_DBACCESS('AdventureWorks2012');