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
Posted Wednesday, February 19, 2014 1:16 AM


Group: General Forum Members
Last Login: Wednesday, September 30, 2015 4:28 PM
Points: 23, Visits: 225
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 ( 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


Group: General Forum Members
Last Login: Friday, September 25, 2015 12:36 PM
Points: 2,409, Visits: 4,557
LAG/LEAD in SQL 2012 would be the best bet I think.

Otherwise, have you investigated the windowing functions?
Post #1542895
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse