Wednesday, October 14, 2020

Size of Database for SQL Server

 SELECT DB_NAME() AS DbName,

name AS FileName,
size/128.0 AS CurrentSizeMB,
size/128.0 - CAST(FILEPROPERTY(name, 'SpaceUsed') AS INT)/128.0 AS FreeSpaceMB
FROM sys.database_files;

No comments: