SQL database growth information
DECLARE @endDate datetime , @months smallint ; SET @endDate = GetDate (); -- Include in the statistic all backups from today SET @months = 6 ; -- back to the last 6 months. ; WITH HIST AS ( SELECT BS . database_name AS DatabaseName , YEAR ( BS . backup_start_date ) * 100 + MONTH ( BS . backup_start_date ) AS BackUpYearMonth , CONVERT ( numeric ( 10 , 1 ), MIN ( BF . file_size / 1048576.0 )) AS MinSizeMB , CONVERT ( numeric ( 10 , 1 ), MAX ( BF . file_size / 1048576.0 )) AS MaxSizeMB , CONVERT ( numeric ( 10 , 1 ), AVG ( BF . file_size / 1048576.0 )) AS AvgSizeMB ...