February 19, 2014 at 12:14 pm
Hi All,
I am really struggling to get a script going for me (ofcourse i am not that good with scripting). Below is my scenario and any help regarding this is greatly appreciated.
>>I had setup a performance monitor on one of our Windows Server 2008 and configured it to collect information every 15 secs and send the data to a SQL database.
>>Perfmon has automatically created 3 tables and is sending the data into them.
>>Two of those tables are
CounterData (CounterID int, CounterDatetime char(24), CounterValue float...)---has the actual counter values
COunterDetails (CounterID int, Machinename varchar(1024), Objectname varchar(1024), Countername varchar(1024)...)---Has the counter information
>>Now in the CounterData table each counter has thousands of records per day.
My Issue:
I am trying to write a script which will give me the average value of each counter per day for the last 7 days starting from the current date.
Please help me with this.
Thanks
February 19, 2014 at 12:22 pm
To get last 7 days of data, you could use some datetime formulas like this:
WHERE DateColumn >= DATEADD( DAY, DATEDIFF(DAY, 0, GETDATE()) - 7, 0)
AND DateColumn < GETDATE()
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply