spTransactions_GetLatestUnprocessedProfileUpdate

Parameters

Parameter Parameter Type Mode Description
@ClientID int IN
@UserID int IN
@RaisersEdgeRecordID int IN

Definition

Copy


            CREATE  procedure [dbo].[spTransactions_GetLatestUnprocessedProfileUpdate]
            @ClientID int,
            @UserID int,
            @RaisersEdgeRecordID int
            as
            begin
            set nocount on

            if @RaisersEdgeRecordID > 0 
            begin
                if @UserID > 0 
                    select top 1 ProfileUpdateTransactionsID,DateLastChanged ,XMLObjectData
                    from dbo.ProfileUpdateTransactions 
                    where clientsID = @ClientID and AddedbyUserID = @UserID and BackOfficeID = @RaisersEdgeRecordID
                    and processed_date is null and IsDeleted = 0
                    order by DateLastChanged desc
                else
                    select top 1 ProfileUpdateTransactionsID,DateLastChanged ,XMLObjectData
                    from dbo.ProfileUpdateTransactions 
                    where clientsID = @ClientID and BackOfficeID = @RaisersEdgeRecordID
                    and processed_date is null and IsDeleted = 0
                    order by DateLastChanged desc
                end
            else
                select top 1 ProfileUpdateTransactionsID,DateLastChanged ,XMLObjectData
                from dbo.ProfileUpdateTransactions 
                where clientsID = @ClientID and AddedbyUserID = @UserID and BackOfficeID is null
                and processed_date is null and IsDeleted = 0
                order by DateLastChanged desc
            end