Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


trouble with attempt to determine growth of DB


trouble with attempt to determine growth of DB

Author
Message
Sl33py
Sl33py
SSC Rookie
SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)

Group: General Forum Members
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 (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?
Gazareth
Gazareth
SSCrazy
SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)

Group: General Forum Members
Points: 2872 Visits: 5351
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search