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
/
25478
< prev
next >
Wrap
Text File
|
2010-06-15
|
2KB
|
66 lines
CREATE PROCEDURE [dbo].[ISA_spWebHttpReponsesRDL]
@ReportType varchar(10),
@FromDate datetime,
@ToDate datetime
AS
BEGIN
DECLARE @SummTableName varchar(100)
SET @SummTableName = dbo.fnGetSummaryTableName('tblHttpResponseSummary', @FromDate, @ToDate, @ReportType)
CREATE TABLE #Table1
(
Response int,
Requests bigint
)
-- This query computes the sums of the requests by HTTP response type
-- 0, 200, 304 --> Success
-- 300, 301, 302 --> Moved
-- 401, 403 --> Forbidden
-- 404 --> Not found
-- All the others
INSERT INTO #Table1 ([Response],[Requests])
VALUES (1,0)
INSERT INTO #Table1 ([Response],[Requests])
VALUES (2,0)
INSERT INTO #Table1 ([Response],[Requests])
VALUES (3,0)
INSERT INTO #Table1 ([Response],[Requests])
VALUES (4,0)
IF OBJECT_ID (@SummTableName, 'u') IS NOT NULL
BEGIN
DECLARE @strQuery varchar(8000)
SET @strQuery =
'SELECT
CASE
WHEN [Response] IN (200, 304, 0) THEN 1
WHEN [Response] IN (300, 301, 302) THEN 2
WHEN [Response] IN (401, 403) THEN 3
WHEN [Response] = 404 THEN 4
ELSE 0
END AS Response,
SUM([Requests]) AS Requests
FROM ' + @SummTableName + '
WHERE ([date] >= ' + QUOTENAME(CONVERT(varchar, @FromDate, 126),CHAR(39)) + ' AND [date] <= ' + QUOTENAME(CONVERT(varchar, @ToDate, 126),CHAR(39)) + ')
GROUP BY [Response]
'
INSERT #Table1
EXEC(@strQuery)
END
DECLARE @TotalRequests bigint
SET @TotalRequests = (SELECT SUM([Requests]) FROM #Table1)
IF (@TotalRequests = 0)
SET @TotalRequests = 1
SELECT
CASE
WHEN [Response] = 1 THEN N'{[23063]}'
WHEN [Response] = 2 THEN N'{[23064]}'
WHEN [Response] = 3 THEN N'{[23065]}'
WHEN [Response] = 4 THEN N'{[23066]}'
ELSE N'{[23067]}'
END AS Response,
SUM([Requests]) AS Requests,
CAST(SUM([Requests]) AS DECIMAL)/@TotalRequests AS RequestRatio
FROM #Table1
GROUP BY [Response]
ORDER BY [Requests] DESC;
END