SQL Server - check space used for each files
One may use the below script to list all the files and their space utilization:
(works for SQL Server 2000 or above)
(works for SQL Server 2000 or above)
select
name
, filename
, convert(decimal(12,2),round(a.size/128.000,2)) as FileSizeMB
, convert(decimal(12,2),round(fileproperty(a.name,'SpaceUsed')/128.000,2)) as SpaceUsedMB
, convert(decimal(12,2),round((a.size-fileproperty(a.name,'SpaceUsed'))/128.000,2)) as FreeSpaceMB
, round(fileproperty(a.name,'SpaceUsed') * 1.00 / a.size * 100 , 2) as used_pct
from dbo.sysfiles
a
order by name
Comments