February 19, 2014 at 1:16 am
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
SSISDB2014-02-19 07:57:06.31347
tempdb2014-02-18 17:29:29.2738
tempdb2014-02-19 07:57:06.3138
Trend_data2014-02-18 17:29:29.273875
Trend_data2014-02-19 07:57:06.3131055
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?
February 19, 2014 at 2:27 am
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?
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply