-- Stored Procedure: dbo.DbSizeTrend -- Bill Wunder use admin GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DbSizeTrend]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[DbSizeTrend] GO CREATE PROCEDURE [dbo].[DbSizeTrend] @DbName sysname = null AS /******************************************************************************************************* * admin.dbo.dbSizeTrend * Creator: Bill Wunder * Date: 3-11-2002 * Outline: show data space over time * does not include log space * * * How it Works: * * usage: * EXECUTE admin.dbo.dbSizeTrend * Notes: * * Modifications * developer name date brief description * ------------------ -------- ------------------------------------------------------------ * ********************************************************************************************************/ -- declare variables -- create temp tables -- set session SET NOCOUNT ON -- body of stored procedure if @DbName is null -- all select DbName, max(SampleDate) as [Latest Date at this size], DataFileSize_KB from admin.dbo.DbPerfHistory group by DbName, DataFileSize_KB order by DbName, max(SampleDate) else -- only one db select Dbname, max(SampleDate) as [Latest date at this size], DataFileSize_KB from admin.dbo.DbPerfHistory where DbName = @DbName group by DbName, DataFileSize_KB order by max(SampleDate) RETURN GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO