Summary Table

Categories Total Count
PII 0
URL 0
DNS 0
EKL 0
IP 0
PORT 0
VsID 0
CF 0
AI 0
VPD 0
PL 0
Other 0

File Content

?-- =============================================
-- Description: Returns a list of distinct users in web logs by date and hour (for visualizations)
--
-- Maintenance Log:
--
-- Update By Update Date Description
-- ----------- --------- ----------------------------
-- =============================================
CREATE PROCEDURE [dbo].[uspRptVizWebLogDistinctUsers]
-- Add the parameters for the stored procedure here
@requestDate date
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

BEGIN TRY
--Get the number of users per date, per day, per hour and per number of users
SELECT
CAST(RequestDate As DATE) AS [date]
, DATEPART(day, RequestDate) AS [day]
, DATEPART(hour, RequestDate) AS [hour]
, COUNT(DISTINCT UserName) AS DistinctUsers
FROM WebLogs
WHERE RequestDate >= @requestDate
AND RequestDate < DATEADD(day, 1, @requestDate)
GROUP BY CAST(RequestDate AS DATE), DATEPART(DAY, RequestDate), DATEPART(HOUR, RequestDate)
ORDER BY 1, 2, 3

END TRY
BEGIN CATCH
PRINT 'There was an error processing the web log visuals' + CHAR(13)
SELECT * FROM dbo.ufnGetErrorInfo()
EXEC uspRaiseErrorInfo
END CATCH
END