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 / 25106 < prev    next >
Text File  |  2010-06-15  |  2KB  |  53 lines

  1. CREATE PROCEDURE [ISA_spDestinationSummary]
  2. AS
  3. BEGIN
  4.     SET NOCOUNT ON;
  5.     IF OBJECT_ID ('tblDestinationSummary', 'u') IS NOT NULL
  6.         DROP TABLE [tblDestinationSummary]
  7.     DECLARE @FromDate datetime
  8.     SET @FromDate = (SELECT [FromDate] FROM [tblSummaryParams])
  9.     CREATE TABLE #Table1
  10.     (
  11.         DestinationIP [uniqueidentifier],
  12.         BytesIn bigint,
  13.         BytesOut bigint,
  14.         TotalBytes bigint,
  15.         Requests bigint,
  16.         Date datetime
  17.     );
  18.     IF OBJECT_ID ('FWS_LOGS', 'view') IS NOT NULL
  19.     BEGIN
  20.         INSERT INTO #Table1
  21.         SELECT
  22.             [DestinationIP] AS DestinationIP,
  23.             SUM([bytesrecvdDelta]) AS BytesIn,
  24.             SUM([bytessentDelta]) AS BytesOut,
  25.             SUM([bytesrecvdDelta]) + SUM([bytessentDelta]) AS TotalBytes,
  26.             CASE
  27.                 WHEN ([Action] = 11) THEN 0
  28.                 ELSE COUNT(*)
  29.             END AS Requests,
  30.             @FromDate AS Date
  31.         FROM FWS_LOGS
  32.         WHERE
  33.             ([Action] != 8) AND
  34.             ([Action] != 10) AND
  35.             ([InternalServiceInfo] & 2) = 0
  36.         GROUP BY
  37.             [DestinationIP],
  38.             [Action];
  39.     END
  40.     SELECT
  41.         [DestinationIP],
  42.         SUM([BytesIn]) AS BytesIn,
  43.         SUM([BytesOut]) AS BytesOut,
  44.         SUM([TotalBytes]) AS TotalBytes,
  45.         SUM([Requests]) AS Requests,
  46.         @FromDate AS Date
  47.     INTO [tblDestinationSummary]
  48.     FROM #Table1
  49.     GROUP BY
  50.         [DestinationIP]
  51.     INSERT INTO [tblSummaryTables] ([TableName]) VALUES ('tblDestinationSummary')
  52. END
  53.