📄 cs_useractivityreportrecords_get.prc
字号:
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[cs_UserActivityReportRecords_Get]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[cs_UserActivityReportRecords_Get]
GO
CREATE PROCEDURE [dbo].cs_UserActivityReportRecords_Get
(
@nRecordNumberStart INT
,@nRecordNumberEnd INT
,@BegReportDate DateTime
,@EndReportDate DateTime
,@Paged BIT
)
AS
BEGIN
IF @Paged = 1
BEGIN
DECLARE @totalRecords INT
--------------------------------------------------------------------
-- Define the table to do the filtering and paging
--------------------------------------------------------------------
DECLARE @tblTempData TABLE
(
nID INT IDENTITY
,IP nvarchar(20)
,VisitCount INT
)
INSERT INTO @tblTempData
(
IP
,VisitCount
)
SELECT IP, SUM(VisitCount) as VisitCount
FROM cs_VisitsDaily AS v
WHERE
v.VisitDate between @BegReportDate and @EndReportDate
GROUP BY
v.IP
ORDER BY
VisitCount DESC
SET @totalRecords = @@rowcount
---------------------------------------------------------------------------------------------------------------------------------------
SELECT
IP
,VisitCount
FROM
@tblTempData
WHERE
nID BETWEEN @nRecordNumberStart AND @nRecordNumberEnd
ORDER BY
nID ASC
-- Return totalRecords
SELECT @totalRecords
END
ELSE
BEGIN
SELECT IP as IP_Address, SUM(VisitCount) as Number_Page_Visits
FROM cs_VisitsDaily AS v
WHERE
v.VisitDate between @BegReportDate and @EndReportDate
GROUP BY
v.IP
ORDER BY
Number_Page_Visits DESC
END
END
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
grant execute on [dbo].[cs_UserActivityReportRecords_Get] to public
go
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -