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 Difference Between a Local and a Global Temporary Tab ...

How is Sqlcmd Different from Osql ?

Showing Server Active Server Name in MS SQL

What is a ROLLUP Clause in SQL Server ?

Using MS SQL TOP