| title | View a List of Databases on an Instance of SQL Server | Microsoft Docs | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| ms.custom | |||||||||
| ms.date | 03/14/2017 | ||||||||
| ms.prod | sql-non-specified | ||||||||
| ms.prod_service | database-engine, sql-database | ||||||||
| ms.service | |||||||||
| ms.component | databases | ||||||||
| ms.reviewer | |||||||||
| ms.suite | sql | ||||||||
| ms.technology |
|
||||||||
| ms.tgt_pltfrm | |||||||||
| ms.topic | article | ||||||||
| helpviewer_keywords |
|
||||||||
| ms.assetid | 7ee7a789-db36-4be9-8a0e-0362a1e152dd | ||||||||
| caps.latest.revision | 31 | ||||||||
| author | stevestein | ||||||||
| ms.author | sstein | ||||||||
| manager | craigg | ||||||||
| ms.workload | Active |
[!INCLUDEappliesto-ss-asdb-xxxx-xxx-md] This topic describes how to view a list of databases on an instance of [!INCLUDEssNoVersion] by using [!INCLUDEssManStudioFull] or [!INCLUDEtsql].
In This Topic
-
Before you begin:
-
To view a list of databases on an instance of SQL Server, using:
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.
-
In Object Explorer, connect to an instance of the [!INCLUDEssDEnoversion], and then expand that instance.
-
To see a list of all databases on the instance, expand Databases.
-
Connect to the [!INCLUDEssDE].
-
From the Standard bar, click New Query.
-
Copy and paste the following example into the query window and click Execute. This example returns a list of databases on the instance of [!INCLUDEssNoVersion]. 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
Databases and Files Catalog Views (Transact-SQL)
sys.databases (Transact-SQL)