Posting into a table

Quote from Adrian Mullins on 2025-04-16, 7:23 amHi
I have a problem with Ancestry coming over to RM. It seems to call the census links Residences in RM. I have identified which are the items in ,y RM database that are really census and I want to copy the residence, amend the type to census and append to the eventtype table
I have sql queries to create those items I wish to append but when I try to append they say I am violating the unique reference numbers ie the unique id number
I can get the very latest id from eventtable by using
COALESCE(MAX(eventid),0)
So, i need to know how to amend those items in my temporary table to start from the latest eventid number and increment by one each line so I dont violate the unique key
Any help appreciated. If there is a better way of doing please let me know.
I would like to know how to povercome this obstacle even if there is a clearer way to go
Incidently,i cant select all residences as some are actually items such as electoral registers so its not as simple as changing fact type as i want to do it to a subset
Thanks for looking and if I can be of any help clarifying if i am not clear please let me know
Hi
I have a problem with Ancestry coming over to RM. It seems to call the census links Residences in RM. I have identified which are the items in ,y RM database that are really census and I want to copy the residence, amend the type to census and append to the eventtype table
I have sql queries to create those items I wish to append but when I try to append they say I am violating the unique reference numbers ie the unique id number
I can get the very latest id from eventtable by using
COALESCE(MAX(eventid),0)
So, i need to know how to amend those items in my temporary table to start from the latest eventid number and increment by one each line so I dont violate the unique key
Any help appreciated. If there is a better way of doing please let me know.
I would like to know how to povercome this obstacle even if there is a clearer way to go
Incidently,i cant select all residences as some are actually items such as electoral registers so its not as simple as changing fact type as i want to do it to a subset
Thanks for looking and if I can be of any help clarifying if i am not clear please let me know

Quote from Tom Holden on 2025-04-16, 6:09 pmIt would be easier to just change the EventTable.EventType for those Events you want changed, leaving the EventID unchanged. That has the virtue of keeping any media, citations, webtags that are linked to the current Residence events tagged the now Census events. That's what I did in Facts - Change Fact Type. If you have isolated those EventIDs in your table, then it should be easy to constrain the UPDATE EventTable statement to operate on only those EventIDs in your table.
It would be easier to just change the EventTable.EventType for those Events you want changed, leaving the EventID unchanged. That has the virtue of keeping any media, citations, webtags that are linked to the current Residence events tagged the now Census events. That's what I did in Facts - Change Fact Type. If you have isolated those EventIDs in your table, then it should be easy to constrain the UPDATE EventTable statement to operate on only those EventIDs in your table.

Quote from Adrian Mullins on 2025-04-17, 5:19 amTom
That answer is brilliant. Its elegant and a far better solution. When you get close you cant see the trees. Thanks for taking the time. I will attempt it.
Also, I have now overcome how to update to avoid the unique constraint
Tom
That answer is brilliant. Its elegant and a far better solution. When you get close you cant see the trees. Thanks for taking the time. I will attempt it.
Also, I have now overcome how to update to avoid the unique constraint