Duplicate key in "View_CMS_Tree_Joined_Regular" error during upgrade

   —   
This article describes how to resolve “The CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name 'dbo.View_CMS_Tree_Joined_Regular' and the index name 'IX_View_CMS_Tree_Joined_Regular_NodeSiteID_DocumentCulture_NodeID'. The duplicate key value is (3, en-US, 87091).” error.
If you encounter this error during the upgrade, you will need to restore a backup copy of your 6.0 database, delete the duplicate key, and then run the SQL upgrade script again.  If you review the last part of the error message, you can see it contains the Document culture and the DocumentNodeID for the duplicate record, which in this case is (3, en-US, 87091).  The SQL query below will return the duplicate record in your database:

SELECT DocumentID, DocumentName, DocumentCulture FROM CMS_Document WHERE DocumentNodeID = '87091'

that is responsible for this error, since you cannot have two documents with the same culture pointing to one node.  You will need to remove one of the nodes, and then run the SQL upgrade script over the database.  You can find the SQL upgrade script in the C:\Program Files (x86)\KenticoCMS\7.0\Upgrade60_70\SQL location.
-EH-


Applies to: Kentico CMS 7.x
Share this article on   LinkedIn