Answers

Jul 16, 2010 - 08:26 AM
Hi MURIUK14,
I think you are reposting this question, here is the solution.
Use this to get the correct data fill in from table A to table B.
this takes care of the exsisting but incorrect records by updating those rows with values from table A and the non-exsisting records in table B by inserting those rows from table A.
MERGE INTO B
USING A
ON (B.id = A.id)
WHEN MATCHED THEN
UPDATE
SET B_col1 = A_col1,
B_col2 = A_col2,
B_col3 = A_col3,
B_col4 = A_col4
WHEN NOT MATCHED THEN
INSERT (B_col1,B_col2,B_col3,B_col4)
VALUES (A_col1,A_col2,A_col3,A_col4);
I think you are reposting this question, here is the solution.
Use this to get the correct data fill in from table A to table B.
this takes care of the exsisting but incorrect records by updating those rows with values from table A and the non-exsisting records in table B by inserting those rows from table A.
MERGE INTO B
USING A
ON (B.id = A.id)
WHEN MATCHED THEN
UPDATE
SET B_col1 = A_col1,
B_col2 = A_col2,
B_col3 = A_col3,
B_col4 = A_col4
WHEN NOT MATCHED THEN
INSERT (B_col1,B_col2,B_col3,B_col4)
VALUES (A_col1,A_col2,A_col3,A_col4);

Mar 31, 2012 - 10:58 AM
The question looks to be abandoned by the user who asked it. If no action is taken within 2 days, a Quomon Moderator will consider closing the question and distributing the points.
The Quomon Team
The Quomon Team
Add New Comment