Given a clear case of SQL server, what's the easiest method to enumerate the databases?

In SQL Server 2000+:

select * from sysdatabases

In SQL Server 2005+:

select * from sys.databases

The main difference is subtle and barely worth mentioning for any one-lining such as this. But for the way much you are likely to be being able to access the machine catalog, you might get some use using this article:

Querying the SQL Server System Catalog

You may also execute sp_helpdb with no argument to obtain fundamental details about all databases. (Pass inside a database title being an argument to obtain more more information about this database).

Do this:

SELECT [name] FROM sys.sysdatabases

You might understand this from exec sp_databases;

These instructions works from SQL 2000+.

 EXECUTE master.sys.sp_MSforeachdb 'USE [?]; EXEC sp_spaceused'