Jump to content
TNG Community

Script to update an eventtype from one tag to another?


Jeff Clenard

Recommended Posts

Jeff Clenard

I am looking for help with writing a SQL script that can be used to update an eventtype from one tag to another. Both types are for individuals, not families. (I am hopeful this is doable.) I imported several GEDCOM files into my primary TNG database a few months back after doing a lot of cleanup in them. I recently realized that I missed one tag in particular; that being a Residence (RESI) tag which should have been changed to one of several Census (EVEN) tags. I've made too many updates since the imports to go to a backup and start over. As a result, I have several thousand Residence (RESI) tags that I want to change to various Census (EVEN) tags based upon date.

For example, I want to select all event records with a Residence (RESI) tag where the event Date contains "1850" and update the tag to a different eventtype (EVEN), in this example, "1850 U.S. Census." My goal is to update all Residence (RESI) tags that align with U.S. Census years 1850, 1860, 1870, etc. using variations of the script. The various U.S. Census tags for each decade are already created and in use. 

My tng_eventtypes table for the two records in the above example looks like the following:

eventtypeID: 3
tag: RESI
description:
display: Residence
type: I

eventtypeID: 413
tag: EVEN
description: 1850 U.S. Census
display: 1850 U.S. Census
type: I

Link to comment
Share on other sites

Rob Severijns

Jeff,

Can't you do it via phpMyadmin and use the Find & Replace function?

Link to comment
Share on other sites

Jeff Clenard

Thanks for the pointer, Rob. I had not considered phpMyAdmin to do the work. I will give it a try after backing up my DB  and follow up here should I have any questions.

Link to comment
Share on other sites

Jeff Clenard

Thanks again for the pointer, Rob. I was able to make all of the desired changes via phpMyAdmin.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...