I have 3 tables, one is a parent table to the other two. I want to separate out a column, moving it into the children tables based on the FK. This needs to be accomplished in SQL (no studio shortcuts).
I have 2 tables like these:
TABLE A:
internalID  |  id  | otherdata
============+======+===========
  myid      |   1  | ...
------------+------+-----------
  my2ndid   |   2  | ...
------------+------+-----------
  1234      |   3  | ...
------------+------+-----------
  5678      |   4  | ...
TABLE B:
internalID  |  FK_toTableA  | otherdata
============+===============+===========
  NULL      |       1       | ...
------------+---------------+-----------
  NULL      |       2       | ...
TABLE C:
internalID  |  FK_toTableA  | otherdata
============+===============+===========
  NULL      |       3       | ...
------------+---------------+-----------
  NULL      |       4       | ...
I'd like to move or copy internalID from TABLE A to TABLE B & TABLE C - based on the FK relationship, then delete the internalID column from TABLE A.
The resulting tables should look like this:
TABLE A:
  id  | otherdata
======+===========
   1  | ...
------+-----------
   2  | ...
------+-----------
   3  | ...
------+-----------
   4  | ...
TABLE B:
internalID  |  FK_toTableA  | otherdata
============+===============+===========
  myid      |       1       | ...
------------+---------------+-----------
  my2ndid   |       2       | ...
TABLE C:
internalID  |  FK_toTableA  | otherdata
============+===============+===========
  1234      |       3       | ...
------------+---------------+-----------
  5678      |       4       | ...
SQL version: 13.0.4001.0
 
     
    