I'm pretty sure this stored procedure is fairly vanilla, with some minor adjustments made over the years, but it's been requested that we remove the error that gets raised when activity has taken place in a record since it appeared in the potential dupes table. The relevant - or what I believe is relevant - code block says:
--------------------------------- CODE BLOCK STARTS HERE -------------------------------------
--If any change has taken place to either record since they were entered into the t_potential_dups--table, log exception and skip.
--First check if this pair is coming from t_potential_dups table or manually picked--RW #4094, added identify_method to manually added criteria
if substring(@criterion, 1, 10) = '!@#$CUSTOM' or @identify_method in (-1,-2) GOTO StartMerging
declare @last_activity_dt datetimedeclare @dupTable_dt datetime
select @last_activity_dt = last_activity_dt from [dbo].t_customer where customer_no = @original_no
select @dupTable_dt = last_update_dtfrom [dbo].t_potential_dups where customer_no = @original_no
If @duptable_dt IS null or @last_activity_dt > @dupTable_dt Raiserror('Merge aborted! Reason: Constituent activity took place on kept customer_no %d since this was scheduled for merging.', 11, 2, @original_no)
select @last_activity_dt = last_activity_dt from [dbo].t_customer where customer_no = @duplicate_no
select @dupTable_dt = last_update_dt from [dbo].t_potential_dups where customer_no = @duplicate_no
If @duptable_dt IS null or @last_activity_dt > @dupTable_dt Raiserror('Merge aborted! Reason: Constituent activity took place on deleted customer_no %d since this was scheduled for merging.', 11, 2, @duplicate_no)
--------------------------------- CODE BLOCK ENDS HERE -------------------------------------
Now, am I correct in assuming that the If statements regarding activity dates, and the subsequent Raiserror statements that follow them, can be commented out and that's that? I'm also assuming that the select statements that follow the Raiserror statements will run regardless of the If statements' logic since there is no BEGIN and END statements to make them a block contingent upon the preceding If statement. Or do I need to comment out the entire block from one If statement to the next? Am I making sense?
Thanks, Tessiturians
Hi Matt,
I think I understand what you are asking, with an IF statement, if there is no BEGIN..END then it only applies to the very next statement. So in this case, should you want to have those errors not be returned, you should comment out the if logic and the raiseerror logic, otherwise, they will still apply to the very next statement.
Did I understand what you were asking, correctly?