title | description | author | ms.author | ms.reviewer | ms.date | ms.service | ms.subservice | ms.topic | helpviewer_keywords | monikerRange | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
View list of databases on SQL Server |
Learn how to view a list of databases on an instance of SQL Server by using SQL Server Management Studio or Transact-SQL. |
WilliamDAssafMSFT |
wiassaf |
mathoma |
09/27/2024 |
sql |
supportability |
how-to |
|
=azuresqldb-current || >=sql-server-2016 || >=sql-server-linux-2017 || =azuresqldb-mi-current |
[!INCLUDE SQL Server Azure SQL Database Azure SQL Managed Instance]
This article describes how to view a list of databases on an instance of [!INCLUDE ssNoVersion] by using [!INCLUDE ssManStudioFull] or [!INCLUDE tsql].
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 [!INCLUDE ssDEnoversion], and then expand that instance.
-
To see a list of all databases on the instance, expand Databases.
-
Connect to the [!INCLUDE ssDE].
-
From the Standard bar, select New Query.
-
Copy and paste the following example into the query window and select Execute. This example returns a list of databases on the instance of [!INCLUDE ssNoVersion]. The list includes the names of the databases, their database IDs, and the dates when the databases were created.
SELECT name, database_id, create_date
FROM sys.databases;
GO