-- orjinal sorgu SELECT DB_NAME() AS DbName, name AS FileName, type_desc, size/128.0 AS CurrentSizeGB, size/128 - CAST(FILEPROPERTY(name, 'SpaceUsed') AS INT)/128.0 AS FreeSpaceGB FROM sys.database_files WHERE type IN (0,1);
-- Ssms de sag click-task-shrink file dedigimizde ikinci secenek olan Reorganize pages before releasing unused space alanindaki Minimum rakamini ekledim. 3satirda
SELECT DB_NAME() AS DbName, name AS FileName, type_desc, CEILING(size/128.0) AS CurrentSizeMB, CEILING(size/128.0 - CAST(FILEPROPERTY(name, 'SpaceUsed') AS INT)/128.0) AS FreeSpaceMB, CEILING(size/128.0)-CEILING(size/128.0 - CAST(FILEPROPERTY(name, 'SpaceUsed') AS INT)/128.0) AS MinimumSpace FROM sys.database_files WHERE type IN (0,1);