spUpdate_EmailJob_Recipient_Opened

Parameters

Parameter Parameter Type Mode Description
@PKID int INOUT
@UpdateDate datetime IN
@Opened bit IN
@OpenedDate datetime IN

Definition

Copy

                CREATE    PROCEDURE [dbo].[spUpdate_EmailJob_Recipient_Opened]
                (
                        @PKID int OUTPUT,
                    @UpdateDate datetime,
                    @Opened bit,
                    @OpenedDate datetime
                )
                AS
                BEGIN
                    set nocount on

                    UPDATE [dbo].EmailJob_Recipient
                    SET
                        [UpdateDate]=getutcdate(),
                        [Opened]=1,
                        [OpenedDate]=getutcdate()
                    WHERE ID=@PKID
                    AND OpenedDate IS NULL
                    --sterling CR333390-122210
                    --we need to ensure that the UpdateDate gets reset even if we've already flagged this as opened
                    --so the REIntegration proc picks this recipient up to be redownloaded to RE if they came back later and donated
                    UPDATE [dbo].[EmailJob_Recipient]
                    SET UpdateDate = @UpdateDate
                    WHERE ID = @PKID
                    AND UpdateDate < @UpdateDate
                END