Microsoft SQL Server

Disclosure: When you purchase through our affiliate links, we earn some commission. This helps us to keep this site running. There are no extra costs to you at all by using our links. Here are more details about our affiliate disclosure

Here we will discuss how to view a list of databases on an instance of SQL Server by using SQL Server Management Studio or Transact-SQL.

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.
SQL Server database list
SQL Server database list

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

Columns

  • database_name – database name
  • database_id – databalase id, unique within an instance of SQL Server
  • created_date – date the database was created or renamed

Rows

  • One row represents one database
  • Scope of rows: all databases on SQL Server instance, including system databases
  • Ordered by database name

LEAVE A REPLY

Please enter your comment!
Please enter your name here