Datamart refresh fails with Description: "Violation of PRIMARY KEY constraint 'PK_CONSTITUENTPREFERRED'

When refreshing the datamart in Blackbaud Direct Marketing and the refresh fails with the following error:"Violation of PRIMARY KEY constraint 'PK_CONSTITUENTPREFERRED'.  Error is seen in the status log.  This is information from a RE database to a BBDM database. 
This is because in the RE database there are one or more constituents with multiple primary addresses.

Run the following script against the RE database:

from constit_address
where PREFERRED = '-1'
group by CONSTIT_ID
having COUNT (Preferred) >1
then take those results and fill in the ids in this script
select first_name, last_name, org_name, constituent_id, id
where ID in ('ID1',
If there is only ID returned just delete the comma and ‘ID2’ portion and enter the one ID into the ID1 field.  This will return the records that have duplicates.  They may actually get more than the one they see in the error logs as well. 

Find the constituent in question and remove the second primary address from their record.


 Blackbaud Direct Marketing

Was this article helpful?