Altova DiffDog 2024 Enterprise Edition

Merging CSV and Database Differences

Home Prev Top Next

After performing a CSV or database data comparison, you can optionally merge differences either from the left to the right database or CSV file, or vice versa. Differences can be merged either in batch for the entire database, or individually at table or even row level.

 

By default, database transactions as well as rollback on error is enabled on data merging (assuming the database supports this), see Database Data Comparison Options.

 

Notes:

 

When merging data to CSV files, transactions and rollback on error is not supported.

It is not possible to merge columns that have an incompatible data type (for example, string to numeric type). Also, sometimes a merge is possible only in one direction (for example, a numeric type may be converted to a string type, but not the opposite).

 

Warning

In case of CSV comparisons, if the first column of the file is not unique, it is not recommended to do a merge. When there is no row uniqueness, then multiple unrelated rows might be affected by DELETE and UPDATE statements.

 

DiffDog will ignore incompatible merges and will notify you, before merging, if such occurrences exist. In the Comparison Result view, merges that are only possible only in one direction are marked with a small red arrow joined with a green arrow. The direction of the green arrow indicates the direction where the merge is possible. For example, in the image below, the description column (of type "text") cannot be mapped to the quantity column because the latter is numeric. However, the quantity column can be mapped to the description column.

dbdiff_compare_data_09

Comparison Result View

 

Executing the merge

After performing a CSV or database data comparison, you can merge the changes in any of the following ways:

 

To merge differences at CSV file or database level, right-click an empty area in the Comparison window and select Merge all Left to Right.

To merge differences at table level, right-click the table in the Comparison window and select Merge Selected Left to Right. For CSV files, this option is equivalent to the previous one, because CSV files contain only one table.

To merge differences at row or cell level, first display the Comparison Result view, as described in Viewing Differences Between Tables. Next, right-click a row (or the affected cells) in the Comparison Result View, and then select ic_copy-L2R Copy from left to right from the context menu.

dbdiff_compare_data_12

© 2017-2023 Altova GmbH