Script to return database file usage (GB) from a database.
USE [DATABASE] GO SELECT DBFiles.fileid as FileID, DBFiles.filename as FileName, DBFiles.name as Name, CONVERT(decimal(18,3),ROUND(((CAST(FILEPROPERTY(DBFiles.Name, 'SpaceUsed') AS decimal) * 8) /1024 /1024), 3)) AS SpaceUsedGB, CONVERT(decimal(18,3),ROUND(((CAST(DBFiles.size AS decimal) * 8) /1024 /1024), 3)) AS FileSizeGB FROM dbo.sysfiles DBFiles GO