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

What is RAISEERROR in SQL Server ?

What is Service Broker in SQL Server ?

What is Change Data Capture in SQL Server ?

Disable All Triggers in MS SQL Server Table

What is the Use of DBCC Commands in SQL Server ?