Database file size in MB in SQL Server 2005

I seen people ask in many forums that how can they find the size of their MDF and LDF file in MB by T-SQL so I thought to publish it here in my blog.

select ceiling(size/128) as ‘fileSizeinMB’,name as ‘filename’,physical_name from sys.database_files

It will return all available files for your database.

Reference: Ritesh Shah
Note: Microsoft Books online is a default reference of all articles but examples and explanations prepared by Ritesh Shah, founder of