Click here to monitor SSC
SQLServerCentral is supported by Redgate
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
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Monday, January 11, 2016 11:14 PM
Points: 25, Visits: 241
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: Yesterday @ 9:21 AM
Points: 2,751, Visits: 5,187
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