Getting List of All Server Databases in MS SQL

The following query should be run to get the list of all databases in the active instance in MS SQL Server.

SELECT Name FROM dbo.sysdatabases

Another method is as follows..

EXEC sp_databases


You May Interest

Generating Random Letters in MS SQL

Using MS SQL If Else

Getting List of All Views in MS SQL Database

What is a Linked Server in SQL Server ?

What are the Authentication Modes in SQL Server ?