Hi,
Your code gives me an error:
Msg 468, Level 16, State 9, Line 8
Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Latin1_General_CI_AS" in the equal to operation.
Use this simple code:
select db_name(database_id) [Name],sum((size*8)/1024) [Size MB] from sys.master_files
group by database_id
Regards
IgorMi
Igor Micev,My blog: www.igormicev.com