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 the Maximum Number of Columns a Table in SQL Server ?

Using CASE WHEN in MS SQL

What is Service Broker in SQL Server ?

What are the INTERSECT Operators in SQL Server ?

What is the Difference Between UNION and UNION ALL in SQL Server ...