spREINT_GetStatsInfo

Parameters

Parameter Parameter Type Mode Description
@MaxRecords int IN
@DownloadStartpoint datetime IN

Definition

Copy

            CREATE  PROCEDURE [dbo].[spREINT_GetStatsInfo]
            (
            @MaxRecords int,
            @DownloadStartpoint datetime = NULL 
            )
            AS
            SET ROWCOUNT @MaxRecords 
            SELECT s.StatsID AS "ID"
            CASE s.UserID WHEN 0 THEN (Select isnull(UserID, 0) from EmailJob_Recipient where ID = s.EmailJobRecipientID) ELSE s.UserID END AS [UserID], 
            s.RequestDate,
            s.PageID,
            sp.pagename,
            '' AS "URL",
            s.frsolicitorid,
            s.frteamid,
            s.EmailJobRecipientID
            FROM dbo.stats s
            LEFT JOIN dbo.sitepages sp on s.pageid = sp.id
            WHERE UserID > 0 AND s.RequestDate > @DownloadStartpoint
            ORDER BY s.RequestDate ASC
            SET ROWCOUNT 0