Violation of PRIMARY KEY constraint 'PK_notification_publish_preference_tbl

  • Updated

When you upgrade to Ektron 9.00 SP2, the database portion of the upgrade displayed the following error:

ERROR! Failed to execute script! 
Violation of PRIMARY KEY constraint 'PK_notification_publish_preference_tbl'. 
Cannot insert duplicate key in object 'dbo.notification_publish_preference_tbl'. 
The duplicate key value is (10082,4). 

An association between a user and an activity type already exists.

After the error occurs, run the following SQL script in SQL Management Studio while pointing to the target database:

DELETE FROM notification_publish_preference_tbl WHERE ActivityTypeId = 4 and UserId in
(SELECT userId FROM User_Default_Preference_tbl WHERE UseDefaultPublishSettings = 0)

ActivityTypeId is 4 so that any user associated with that ID is removed.

After running the script, re-run the upgrade script, which adds the associations back into the table. The upgrade script is located at   C:\Program Files (x86)\Ektron\CMS400v9xx\Utilities\SiteSetup\Database\cms400_upgrade_data.sql