The title of this page was really difficult to compose. It has to do with records in a RootsMagic database’s FamilyTable for which each record pairs the record numbers of a ‘husband’ and a ‘wife’, i.e., columns named “HusbandID” and “WifeID”. Set aside questions of gender.
When a person is linked to a single parent, a record is added to the ChildTable for that person with a pointer to a record added to the FamilyTable (FamilyID) in which one of HusbandID or WifeID is 0. It is possible for multiple children to be linked to more than one record (family) in the FamilyTable that have the same pairing of a person in the database (has a RIN) with a spouse having no RIN. In that case, the ID’d spouse will be seen to have multiple spouses and the children will be spread across multiple families.
From a user’s perspective, since nothing is known about the unidentified parent, it is desirable to combine all the children under the single known parent and to merge the duplicate unknown spouses. Consequently, the objective might be described in a few ways, different from the page title, e.g.:
- Merge Unknown Spouses
- Merge Single-Parent Families
- Merge Duplicate Couples
- …
The stimulus for this script came from the following message posted to Submit Your Problem page:
Merge unknown spouses
I have a good number of people where one of the spouses is unknown (usually the wife). When I imported to RM (from The Master Genealogist) a separate unknown spouse was assigned to each of the children. For instance, in TMG I had John Smith with 1 unknown wife and 5 children. In RM I have John Smith with 5 unknown wives, each with 1 child. I need a SQLite that will merge the children under the known spouse and combine all the unknown spouses.
The script is fairly crude and may have unexpected side effects so try it on a copy of your database and review extensively before adopting it as your new master database. One very likely effect will be incidents of the empty Family View symptom which can be fixed using the script at SpouseID Invalid.
ParentSingleMerge.sql rev 2017-02-14 corrected bug that assigned all children to 1 parent