How to select size of all sql server Databases
Below script will select the size of all your SQL Server databases in MB and GB as well.
SELECT d.NAME
,ROUND(SUM(CAST(mf.size AS bigint)) * 8 / 1024, 0) Size_MBs
,(SUM(CAST(mf.size AS bigint)) * 8 / 1024) / 1024 AS Size_GBs
FROM sys.master_files mf
INNER JOIN sys.databases d ON d.database_id = mf.database_id
WHERE d.database_id > 4 -- Skip system databases
GROUP BY d.NAME
ORDER BY d.NAME