Update SQL Table with a challenge

Hi…

I have a table with four columns that I need to use to update a SQL table.

There [PupilID] and [ContactId] fields are the “WHERE” in the DB Update node, and the [ContactID_New] and [FamilyNumber] fields are the “SET”, but I need the [ContactID_New] field to update the [ContactId] field.

Config

Unfortunately, the [PupilID] and [ContactId] are not individually unique, it is only when they are paired that the combined ‘value’ makes the unique pk value so they both have to be included in the “WHERE” and obviously the column names have to be unique so I cannot rename [ContactID_New] to [ContactId]

Is there a workaround for this somewhere?

Thanks

tC/.

2 Likes

Hi,
I don’t know any nice way of doing this, but could you pull all the records to be changed from the database, then delete them from the database using DB Delete and then insert the new ones using DB Insert? You could wrap that into a DB Transaction Start and DB Transaction End to make sure all changes or nothing is actually persisted.
Kind regards,
Alexander

3 Likes

Hi @AlexanderFillbrunn

Thanks for your suggestion. Deleting the rows and then inserting the update dated rows worked really well. Using the DB Transaction Start and DB Transaction End nodes was a awesome advise as well…

Many thanks.

tC/.

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.