SELECT f.name AS [File Name]
,f.physical_name AS [Physical Name]
,CAST((f.size / 128.0) AS DECIMAL(15, 2)) AS [Total Size in MB]
,CAST(f.size / 128.0 - CAST(FILEPROPERTY(f.name, 'SpaceUsed') AS INT) / 128.0 AS DECIMAL(15, 2)) AS [Available Space In MB]
,f.[file_id]
,fg.name AS [Filegroup Name]
,f.is_percent_growth
,f.growth
,fg.is_default
,fg.is_read_only
,fg.is_autogrow_all_files
FROM sys.database_files AS f WITH (NOLOCK)
LEFT OUTER JOIN sys.filegroups AS fg WITH (NOLOCK) ON f.data_space_id = fg.data_space_id
ORDER BY f.[file_id]
OPTION (RECOMPILE);
filegroups, database_files