USP_AMPROIMPORT_FIXCONSTITUENTID

Fixes constituent IDs in AuctionMaestro Pro import exception batches.

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier INOUT
@CURRENTBATCHID uniqueidentifier IN

Definition

Copy


            create procedure dbo.USP_AMPROIMPORT_FIXCONSTITUENTID
            (
                @ID uniqueidentifier = null output,
                @CURRENTBATCHID uniqueidentifier = null
            )
            as
            set nocount on;

            if @ID is not null and not exists(select ID from dbo.CONSTITUENT where CONSTITUENT.ID = @ID)
            begin
                if not exists(select ID from dbo.BATCHAMPROIMPORT where BATCHID = @CURRENTBATCHID and ID = @ID)
                begin
                    if exists(select ID from dbo.BATCHAMPROIMPORT where BATCHID = @CURRENTBATCHID  and ORIGINATINGBATCHROWID = @ID)
                        select top 1 @ID = ID from dbo.BATCHAMPROIMPORT where BATCHID = @CURRENTBATCHID  and ORIGINATINGBATCHROWID = @ID;
                    else
                        set @ID = null;
                end
            end