General information
Category:
Coding, syntax & commands
Title:
Updating new parent key into child table
I have a corporation parent table with an executive child table. These are older tables that use a numeric 'corpid' to link the two tables. I want to update the primary key to use sys(2015). I added a new field in the parent table called ccorp_id with the new style key, and now I want to update all the child records with that new key.
For example: Parent Corp record has a corpid=1 and all the child record reference that corpid of 1 in the child table. I want to update the ccorp_id field in the child table to match the ccorp_id in the parent table.
I have tried to put together an update SQL that sets corp.ccorp_id=exec.ccorp_id (new key) where corp.corpid=exec.corpid (old key), but I just can't seem to get the syntax correct.
Can anyone help me with this?
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only