SQL Query - sql 2005/2008 - data migration
Posted on 2011-10-20
Having the following tables:
column: A_IDPK, ADesc, A_X,B_ID(FK)
column: B_ID, BDesc
column: C_IDPK, BDesc, C_A_X, B_ID(FK),AutoIDoFA
TableA is already populated, table B is already populated.
I can use the source table to populate tableC.
The column A_X is unique identifier for table A, it also matches with C_A_X in tableC.
The source table already has a column matching C_A_X. so there is no problem to populate
this column when migrating data to tableA.
I like to write a query to update the value of C_X with
what I need to do is to actually find the relevant A_IDPK of A_X and also put that number into tabeC.AutoIDoFA.
how can this be done.
Thanks in advance