How-to: Merge differences between data in a table in two databases
Merging data with SQLMerger is simple.
You will use an action that will go through the target's data, make the changes needed, and set whether the lines should be updated, added or deleted.
Do:
1. Open your table.
You can open both tables by using the option "Open Source & Target" from the "Item" menu, or you can just click the [Open Source] and [Open Target] buttons.
(Notice, if you invoke an operation in SQLMerger that needs data SQLMerger will open the data automatically, for your convenience.)
The database etc. shown below in the example is from the built-in demo.
When data has been opened the main window will look like:
|
|
Differences between a table in the "from" and "to" database (Source and Target)
|
2. Invoke a merge operation.
Choose the option "Make Target = Source" from the "Actions" menu.
|
|
Invoking Merge operations
|
This action modifies the data in the target area, making it reflect the needed changes.
When data has been merged the main window will show:
|
|
Now you can see what is going to be changed when you post the changes into the database (next step)
|
You can still go in and make several changes manually by typing directly into the columns (if you do, SQLMerger will refresh the "Difference" column of the lines you're making different from the source).
You can also remove e.g. the check for updating, in the line with Id 2
3. Post the changes.
First select the "Script" tab.
This generates a change script for the changes that has been specified in the "Target" data area.
Then click the [Execute Script] button.
The sends the changes to the database.
|
|
The automatically generated change script is executed.
|
When you have clicked the [Execute] button the database have been updated.
4. Go back to the "Merge" tab.
What you see now are the new contents in the database. The color codes will reflect the new contents.
|
|
The new contents after the merging
|
You're finished!
A complete set of merge operations exists in SQLMerger, the one shown here is just one of many.
Tip:
The moment you select the "Script" tab SQLMerger automatically generates change script. You still have time to make changes in it before you execute it. All the script that can be executed correctly is logged automatically in a common (configurable) log file.
Back to Overview...