home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
moodle.waes.ac.uk
/
moodle.waes.ac.uk.zip
/
moodle.waes.ac.uk
/
TMG
/
SP1-TMG-KB981324-AMD64-ENU.msp
/
PCW_CAB_SHFx2
/
F2143_msfpcui.dll
/
BINARY
/
25053
< prev
next >
Wrap
Text File
|
2010-06-15
|
1KB
|
36 lines
CREATE PROCEDURE [dbo].[ISA_spUsageSummaryMonthly]
@CurrentMonthFirstDay datetime,
@CurrentMonthLastDay datetime,
@LastDailyToKeep datetime,
@LastMonthlyToKeep datetime
AS
BEGIN
SET NOCOUNT ON;
-- move dailies to monthlies (scale up from HOUR intervals to DAY intervals)
INSERT INTO dbo.tblUsageSummary_Monthly
SELECT
DATEADD(day, DATEPART(day, [Date]) - 1, @CurrentMonthFirstDay) AS Interval,
SUM([CacheHits]) AS [CacheHits],
SUM([processingtime]) AS ProcessingTime,
SUM([TotalBytes]) AS TotalBytes,
SUM([Requests]) AS Requests,
SUM([WebRequests]) AS WebRequests,
MAX([MaxConcurrentConnectionsPerMinute]) AS MaxConcurrentConnectionsPerMinute,
@CurrentMonthFirstDay AS Date
FROM dbo.tblUsageSummary_Daily
WHERE (Date >= @CurrentMonthFirstDay) AND
(Date <= @CurrentMonthLastDay)
GROUP BY
DATEPART(day, [Date])
-- cleanup dailies
DELETE FROM [ISA_RS_Db].[dbo].[tblUsageSummary_Daily]
WHERE (Date < @LastDailyToKeep)
-- cleanup monthlies
DELETE FROM [ISA_RS_Db].[dbo].[tblUsageSummary_Monthly]
WHERE (Date < @LastMonthlyToKeep)
END