This Video describes method to manage the database and disk size on SQL Server when you want to restrict the database to particular size and have option to purge the old data.
Below is the script used to find free space in data and log file of the database
SELECT DB_NAME() AS DbName,
name AS FileName,
type_desc,
size/128.0 AS CurrentSizeMB,
size/128.0 - CAST(FILEPROPERTY(name, 'SpaceUsed') AS INT)/128.0 AS FreeSpaceMB
FROM sys.database_files
WHERE type IN (0,1);
Download
0 formats
No download links available.
Manage Database And Disk Size in SQL Server | NatokHD