Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

trouble with attempt to determine growth of DB Expand / Collapse
Author
Message
Posted Wednesday, February 19, 2014 1:16 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, October 6, 2014 10:32 PM
Points: 20, Visits: 189
Hi all

I am having a bit of trouble with the following, I have a table for tracking DB growth and a procedure to populate the table that runs once a week (http://sqljourney.wordpress.com/2013/02/13/sql-server-track-database-size-growth-trend/). The issue is that i wish to determine the growth in Mb/Gb between entries. here is an example of the query output:

DB_NAME CollectionDate SizeInMB
SSISDB 2014-02-19 07:57:06.313 47
tempdb 2014-02-18 17:29:29.273 8
tempdb 2014-02-19 07:57:06.313 8
Trend_data 2014-02-18 17:29:29.273 875
Trend_data 2014-02-19 07:57:06.313 1055

I was wanting to add a "growth" column to the end to calculate the difference between the current collection date and the one prior.

I have tried a few things
(datediff) but seem to be getting further away, could anyone perhaps help point me in the right direction?
Post #1542883
Posted Wednesday, February 19, 2014 2:27 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 9:37 AM
Points: 2,114, Visits: 3,719
LAG/LEAD in SQL 2012 would be the best bet I think.
http://technet.microsoft.com/en-us/library/hh231256.aspx

Otherwise, have you investigated the windowing functions?
http://technet.microsoft.com/en-us/library/ms189461.aspx
Post #1542895
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse