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
/
25101
< prev
next >
Wrap
Text File
|
2010-06-15
|
1KB
|
36 lines
CREATE PROCEDURE [dbo].[ISA_spDroppedUserSummaryTrim]
AS
BEGIN
SET NOCOUNT ON;
IF OBJECT_ID ('tblDroppedUserSummary', 'u') IS NULL
RETURN
DECLARE @FromDate datetime
SET @FromDate = (SELECT [FromDate] FROM [tblSummaryParams])
SELECT *
INTO #TABLE1
FROM (
SELECT
[UserName], [DroppedPackets], [Date]
FROM (
SELECT
[UserName], [DroppedPackets], [Date],
ROW_NUMBER() OVER (ORDER BY [DroppedPackets] DESC) AS rownum
FROM dbo.[tblDroppedUserSummary] ) t
WHERE rownum <= 10000
UNION ALL
SELECT
N'{[23124]}', SUM([DroppedPackets]), @FromDate
FROM (
SELECT
[UserName], [DroppedPackets],
ROW_NUMBER() OVER (ORDER BY [DroppedPackets] DESC) AS rownum
FROM dbo.[tblDroppedUserSummary] ) t
WHERE rownum > 10000
) ttt
WHERE [DroppedPackets] IS NOT NULL
TRUNCATE TABLE [tblDroppedUserSummary]
INSERT INTO [tblDroppedUserSummary]
SELECT *
FROM #TABLE1
END