The following statement returns the size of all databases in current SQL Server instance in Megabytes. Information is separated in data and log information.
with fs
as
(
select database_id, type, size * 8 / 1024 size
from sys.master_files
)
select
name,
(select sum(size) from fs where type = 0 and fs.database_id = db.database_id) DataFileSizeMB,
(select sum(size) from fs where type = 1 and fs.database_id = db.database_id) LogFileSizeMB
from sys.databases db