Get List of Databases & Their Size on SQL server

Sometimes it requires us to know how many database resides in SQL Server ? and what are the sizes of these databases?

We are generally interested in a simple query that will provide the desired result.

You can run the below mentioned query in your SQL Server  to achieve this result :

SELECT sd.name,Convert(Decimal(10,0),(mf.size /1024)) As size

FROM

sysdatabases sd

INNER JOIN sys.master_files mf ON mf.database_id = sd.dbid

          AND mf.type = 0

WHERE sd.Name Not IN ('MASTER','tempdb','Model','MSDB')

 
I hope this will help you somewhere.