View a List of Databases on an Instance of SQL Server

This topic describes how to view a list of databases on an instance of SQL Server by using SQL Server Management Studio or Transact-SQL.

In This Topic

  • Before you begin:

    Security

  • To view a list of databases on an instance of SQL Server, using:

    SQL Server Management Studio

    Transact-SQL

Before You Begin

Security

Permissions

If the caller of sys.databases is not the owner of the database and the database is not master or tempdb, the minimum permissions required to see the corresponding row are ALTER ANY DATABASE or VIEW ANY DATABASE server-level permission, or CREATE DATABASE permission in the master database. The database to which the caller is connected can always be viewed in sys.databases.

Arrow icon used with Back to Top link [Top]

Using SQL Server Management Studio

To view a list of databases on an instance of SQL Server

  1. In Object Explorer, connect to an instance of the SQL Server Database Engine, and then expand that instance.

  2. To see a list of all databases on the instance, expand Databases.

Arrow icon used with Back to Top link [Top]

Using Transact-SQL

To view a list of databases on an instance of SQL Server

  1. Connect to the Database Engine.

  2. From the Standard bar, click New Query.

  3. Copy and paste the following example into the query window and click Execute. This example returns a list of databases on the instance of SQL Server. The list includes the names of the databases, their database IDs, and the dates when the databases were created.

USE AdventureWorks2012;
GO
SELECT name, database_id, create_date
FROM sys.databases ;
GO

Arrow icon used with Back to Top link [Top]

See Also

Reference

Databases and Files Catalog Views (Transact-SQL)

sys.databases (Transact-SQL)