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
/
25470
< prev
next >
Wrap
Text File
|
2010-06-15
|
1KB
|
44 lines
CREATE PROCEDURE [dbo].[ISA_spTrafficErrorsRDL]
@ReportType varchar(10),
@FromDate datetime,
@ToDate datetime
AS
BEGIN
DECLARE @SummTableName varchar(100)
SET @SummTableName = dbo.fnGetSummaryTableName('tblErrorSummary', @FromDate, @ToDate, @ReportType)
CREATE TABLE #Table1
(
Error nvarchar(32),
Requests bigint
)
IF OBJECT_ID (@SummTableName, 'u') IS NOT NULL
BEGIN
DECLARE @strQuery varchar(8000)
SET @strQuery =
'SELECT
[Error] AS Error,
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 [Error]
'
INSERT #Table1
EXEC(@strQuery)
END
DECLARE @TotalRequests bigint
SET @TotalRequests = (SELECT SUM([Requests]) FROM #Table1)
IF (@TotalRequests = 0)
SET @TotalRequests = 1
SELECT
Error,
Requests,
CAST([Requests] AS DECIMAL)/@TotalRequests AS RequestRatio
FROM #Table1
ORDER BY [Requests] DESC;
END