You will find information on this topic in the following discussion on the Community.
As the above discussion indicates, there are a number of things to consider here. You have probably already found that a "duplicate" code can not be deleted unless all usage has been updated to reflect the "new" code. Special considerations come into play if Multicores are involved.
It looks like the recommended method is to use the "Copy Component Details" utility to re-assign all usages of a code.
This works for most codes but "Wire Sizes" codes and some others are not easily re-assigned using this method.
I have found that doing a find and replace in the Component Library XML will allow me to re-assign all usages of a code.
Yes, exporting the subject parts, editing the XML data, and re-importing the parts is a method that can be used here. I would have mentioned it in my earlier reply, but this is not generally advised unless the user has a good working knowledge of the XML data structure and appropriate editing tools.
Happy to hear you had success with this method.