List databases on SQL Server instance

Query below lists databases on SQL Server instance.

Query

select [name] as database_name, 
    database_id, 
    create_date
from sys.databases
order by name

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

Sample results

View of databases in SSMS. Blue rectangle selects system databases.