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 / 25566 < prev    next >
Text File  |  2010-06-15  |  1KB  |  41 lines

  1. CREATE PROCEDURE [dbo].[ISA_spUrlfActivity]
  2.     @ArrayName nvarchar(MAX),
  3.     @ServerName nvarchar(MAX),    
  4.     @FromDate datetime, 
  5.     @ToDate datetime,
  6.     @CollectionTime datetime
  7. AS
  8. BEGIN
  9.     IF OBJECT_ID ('dbo.[tblUrlfSummary_Daily]', 'u') IS NULL RETURN
  10.     SELECT
  11.         @ArrayName As ArrayName,
  12.         meta.[UrlCategoryName],
  13.         urlfid.[UrlCategoryHits],
  14.         urlfid.[UrlCategoryBlocked],
  15.         @CollectionTime As CollectionTime
  16.     FROM
  17.     (
  18.         SELECT 
  19.             result.[UrlCategoryId] As UrlCategoryId,
  20.             sum(result.[UrlCategoryHits]) As UrlCategoryHits,
  21.             sum(result.[UrlCategoryBlocked]) As UrlCategoryBlocked
  22.         FROM
  23.         (
  24.             SELECT
  25.                 [UrlCategoryId],
  26.                 sum([Requests]) As UrlCategoryHits,
  27.                 case
  28.                     when [action]=8 then sum([Requests])
  29.                     else 0
  30.                 end as UrlCategoryBlocked
  31.             FROM  dbo.[tblUrlfSummary_Daily]
  32.             WHERE ([date] >= @FromDate AND [date] <= @ToDate AND [UrlCategoryId] >= 0) AND (isnull(dbo.tblUrlfSummary_Daily.ServerName,@ServerName)=@ServerName)
  33.             GROUP BY [UrlCategoryId], [Action]
  34.         ) As result
  35.         GROUP BY result.[UrlCategoryId]    
  36.     ) As urlfid
  37.     INNER JOIN [tblUrlfMetadata] AS meta
  38.     ON urlfid.[UrlCategoryId] = meta.[UrlCategoryId];
  39. END
  40.  
  41.