Pages

Friday, August 10, 2012

Find free space in MDF file of SQL Server

How to find the free space available in the phyical files of the database (MDF and LDF)

SELECT name ,size/128.0 - CAST(FILEPROPERTY(name, 'SpaceUsed') AS int)/128.0 AS AvailableSpaceInMB FROM sys.database_files