SQL Server – How to get all database names in SQL Server

One of my colleague ask me a query to retrieve all the database names in a SQL Server.

Here is the SQL Server Query to retrieve the same.

Query:
SELECT
name
FROM
master.dbo.sysdatabases

Share this:
Share

Leave a Reply

Your email address will not be published. Required fields are marked *