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 / 25083 < prev    next >
Text File  |  2010-06-15  |  905b  |  32 lines

  1. CREATE PROCEDURE [dbo].[ISA_spObjectTypeSummaryMonthly] 
  2.     @CurrentMonthFirstDay datetime,
  3.     @CurrentMonthLastDay datetime,
  4.     @LastDailyToKeep datetime,
  5.     @LastMonthlyToKeep datetime
  6. AS
  7. BEGIN
  8.     SET NOCOUNT ON;
  9.  
  10. -- move dailies to monthlies
  11.     INSERT INTO dbo.tblObjectTypeSummary_Monthly
  12.     SELECT [ObjectName],
  13.            SUM(BytesIn),
  14.            SUM(BytesOut),
  15.            SUM(TotalBytes),
  16.            SUM([Requests]),
  17.            @CurrentMonthFirstDay AS Date
  18.     FROM dbo.tblObjectTypeSummary_Daily
  19.     WHERE (Date >= @CurrentMonthFirstDay) AND
  20.           (Date <= @CurrentMonthLastDay)
  21.     GROUP BY [ObjectName]
  22.  
  23. -- cleanup dailies
  24.     DELETE FROM [ISA_RS_Db].[dbo].[tblObjectTypeSummary_Daily]
  25.     WHERE (Date < @LastDailyToKeep)
  26.  
  27. -- cleanup monthlies
  28.     DELETE FROM [ISA_RS_Db].[dbo].[tblObjectTypeSummary_Monthly]
  29.     WHERE (Date < @LastMonthlyToKeep)
  30.  
  31. END
  32.