This article is half-done without your Comment! *** Please share your thoughts via Comment ***
In this post, I am sharing a SQL Script to find free and occupied space for database storage files.
You can also use SSMS GUI which provides the information on free and occupied space for individual Database.
But I am always using the script for the DBA reports where we can customize as per our requirements.
Below is a script:
1 2 3 4 5 6 7 8 |
SELECT Fileid ,CONVERT(DECIMAL(12,2),ROUND(Size/128.000,2)) AS FileSizeInMB ,CONVERT(DECIMAL(12,2),ROUND(FILEPROPERTY(Name,'SpaceUsed')/128.000,2)) AS UsedSpaceInMB ,CONVERT(DECIMAL(12,2),ROUND((Size-FILEPROPERTY(Name,'SpaceUsed'))/128.000,2)) AS FreeSpaceInMB ,Name AS DatabaseName ,FileName AS FileName FROM dbo.sysfiles |