Hi there,
I want to share a smart little script for checking free space in the files of a database.
See the script below:
Copyable Version:
SELECT
a.FILEID,
CONVERT(decimal(12,2),ROUND(a.size/128.000,2)) as [Filesize_MB] ,
CONVERT(decimal(12,2),ROUND(fileproperty(a.name,'SpaceUsed')/128.000,2)) as [Used_Space_MB],
CONVERT(decimal(12,2),ROUND((a.size-fileproperty(a.name,'SpaceUsed'))/128.000,2)) as [Free_Space_MB],
a.name as [Database_Name],
a.FILENAME as [File_Name]
FROM
dbo.sysfiles a
No comments:
Post a Comment