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 / 25093 < prev    next >
Text File  |  2010-06-15  |  786b  |  29 lines

  1. CREATE PROCEDURE [dbo].[ISA_spErrorSummaryMonthly] 
  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.tblErrorSummary_Monthly
  12.     SELECT [Error]
  13.           ,SUM([Requests])
  14.           ,@CurrentMonthFirstDay AS Date
  15.     FROM dbo.tblErrorSummary_Daily
  16.     WHERE (Date >= @CurrentMonthFirstDay) AND
  17.           (Date <= @CurrentMonthLastDay)
  18.     GROUP BY [Error]
  19.  
  20. -- cleanup dailies
  21.     DELETE FROM [ISA_RS_Db].[dbo].[tblErrorSummary_Daily]
  22.     WHERE (Date < @LastDailyToKeep)
  23.  
  24. -- cleanup monthlies
  25.     DELETE FROM [ISA_RS_Db].[dbo].[tblErrorSummary_Monthly]
  26.     WHERE (Date < @LastMonthlyToKeep)
  27.  
  28. END
  29.