To get the list of all the databases in SQL Server use the following system stored procedure
exec sp_databases;
Result:
DATABASE_NAME | DATABASE_SIZE | REMARKS |
master | 5120 | NULL |
model | 2816 | NULL |
msdb | 11264 | NULL |
ReportServer$SQL2008DEV | 10240 | NULL |
ReportServer$SQL2008DEVTempDB | 3072 | NULL |
SQLThreads | 4096 | NULL |
tempdb | 8704 | NULL |
Alternatively you can also use SQL Query as given below.
SELECT * FROM sys.databases;