Technical Article

List the Databases To Which You Have Access

,

Explanation:

sys.databases contains information about all databases on the SQL Server instance.

• HAS_DBACCESS(name) = 1 filters out the databases you dont have access to.

•ORDER BY name sorts the result alphabetically.

 

SELECT name
FROM sys.databases
WHERE HAS_DBACCESS(name) = 1
ORDER BY name;

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating