Save size of databases into a table
Every time we run the procedure we generate a row for each database on server with the current size. Then inthe future we can estimate the growth of the databases.
Last updated:
Warning: Review and test in a non-production environment before running.
ALTER procedure [dbo].[Sammy_SaveDatabaseSize]
as
begin
create table #t
(
[name] sysname,
[db_size] nvarchar(13),
[owner] sysname,
[dbid] smallint,
[created] nvarchar(11),
[status] nvarchar(600),
[compatibility_level] tinyint
)
insert into #t exec sp_helpdb
insert into DatabaseSize
select [name],convert(decimal(12,2),
substring(db_size,1,len(db_size)-3)),getdate()
from #t
drop table #t
end