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

Using MS SQL TOP

What is Blocking in SQL Server ?

MS SQL Compiling a Stored Procedure With a Requery

Getting List of All Stored Procedures in Database in MS SQL

What are Table Valued Parameters ?