A. The SQL Server specific way (all versions) is :-

select name from master..sysdatabases

The ANSI standard way (SQL 7 only) is :-

select CATALOG_NAME from INFORMATION_SCHEMA.SCHEMATA


Read more FAQs and learn more about "Creating SQL Server Databases."