How to Get Sql server Data file and Log file Size

In sql server 2000 and 2005 more than people using select case .

 Select case when Temp_Name is null or Temp_Name='' 
then 'No Name'
else Temp_Name
End as TEmp_Name from TblTemp

Instead of using case you can user null if function

Select isnull(nullif(Temp_Name,''),'No Name')Temp_Name from TblTemp 

you are also get same result from both query.

how to get size of sql server  log file and data file in MB

 SELECT database_id,

CONVERT(VARCHAR(25), DB.name) AS dbName,

(SELECT SUM((size*8)/1024) FROM sys.master_files WHERE DB_NAME(database_id) = db.name AND type_desc = 'rows') DATA_MB,

(SELECT SUM((size*8)/1024) FROM sys.master_files WHERE DB_NAME(database_id) = db.name AND type_desc = 'log') AS [Log MB]

FROM sys.databases DB

WHERE name in (select name from sys.databases)