Skip to content
The latest version of DbVisualizer was released 2024-08-30DOWNLOAD HERE ->

Comparing Data

Only in DbVisualizer Pro

This feature is only available in the DbVisualizer Pro edition.

With DbVisualizer, you can compare grids and text data, such as scripts or the DDL for two tables or procedures.

Selecting the Objects to Compare

You can open the Compare Objects object chooser via Tools->Compare... and select two objects available for comparison.

image2021 1 11 11 42 47

If you select Editor, all SQL Commander editors and all Object View sub tabs that you have opened that contain text, such as DDL , SQL Editor, and Procedure Editor tabs, are listed. There is also an entry for the System Clipboard, holding the last text you copied.

Selecting Grids lists all SQL Commander Result Set tabs and all Object View sub tabs that you have opened that contain a grid, for instance the Data and Columns tabs for a table, or the Tables tab for a schema.

To compare two objects, select one each in the Left Object and Right Object columns and click Compare.

You can also open the object selection dialog from the Compare... item in the right-click menu inside a tab that holds an object that can be compared. The object shown in that tab is then preselected as the Right Object so you only need to select the Left Object in the dialog.

The right-click menu for an SQL Commander editor also contains a Compare to Saved entry. This bypasses the object selection dialog and opens the Compare window directly, showing you how you have changed the script since loading it into the editor.

Comparing Text Data

To compare text data, either select both text object from the Tools->Compare dialog or choose Compare from the right-click menu in one of them and select the one to compare to. The text compare window shows you how they differ.

image2021 1 11 11 43 35

The objects are shown side-by-side, with indications about how they differ in the divider between them. The margin areas outside the left and right objects have markings that also show sections of differences. You can navigate between the differences using the arrow buttons in the toolbar, or by clicking the markings to the left and right.

Comparing two texts is pretty straightforward. You can see what has been changed, inserted and deleted, with row level indications in the divider and details for changed text highlighted in the text panes. A difference may start on one line and span over multiple lines until a match is found again.

If the right object is editable, you can apply the changes needed to remove the differences, one by one or all at once.Along with the difference indications in the divider there are small icons: arrows and cross marks. Clicking on such an icon updates the modified object to match the original object, by inserting or deleting one or more rows or updating the text or column values.

If you want to apply all changes needed to make the right object match the left object, you can click on the Sync button in the toolbar (the second to rightmost button).

You can also edit the right object directly in the Compare window.

No matter how you update the right object, all changes are also applied to the tab where the object was originally opened. To permanently save the changes, you need to use the Save button in that tab.

If you want to change sides when comparing objects, you can click the Flip button in the toolbar (the rightmost button). One reason for doing this may be that you want to update the object you originally used as the original instead of the modified object.

Comparing Grids

To compare grids, either select both grid object from the Tools->Compare dialog or choose Compare from the right-click menu in one of them and select the one to compare to. The Compare Grids window shows you how they differ.

image2021 1 11 12 13 18

Comparing grids is a bit complicated, since each row is a unit in itself, with a unique identifier in the form of a Key. A difference can therefore not span rows. It is also important that both grids are sorted the same way and that the column in one grid is compared to the corresponding column in the other grid, otherwise the result is indeterminably. By default, columns are matched by name, or index if the names differ.

If the default matching is not correct, click the Column Configuration button in the toolbar to manually match the columns, and optionally select key columns and ignore some columns.

image2021 1 11 12 15 20

Use the Right Column Name drop down lists to select the column matching the Left Column Name. If a column does not match another, just leave it blank to exclude it from the comparison.

Use the Key Column check boxes to pick the columns that should be used as the key when comparing the grids. If you don't care about the value in some columns, e.g. a column that contains a timestamp that may vary between the grids without being an important difference, you can check the Ignore Column check box for that column to exclude it for the comparison.

It gets a bit more complicated if a key column value is changed.

image2021 1 11 12 22 37

DbVisualizer considers a changed key value as one inserted row and one deleted row, as shown in the figure above. If the grids do not have any declared key columns, all columns are considered to be regular, non-key columns.

Two grids may also differ in the number of columns they contain. DbVisualizer finds columns that only exist in one of the grids and excludes their values when comparing the grids. If the column names do not match between the two grids, open the Column Configuration dialog to manually map the columns.

image2021 1 11 12 25 17

Similarly, DbVisualizer does not consider Binary/BLOB and CLOB columns when comparing, and marks them as ignored. You can manually specify that CLOB columns should be compared in the Column Configuration dialog.

image2021 1 11 12 27 31

Error rendering macro 'excerpt-include' : No location was provided.

Comparing Cell Values

In a Data tab or a result set tab, you can also compare the values of two selected cells.

  1. Select the two cells to compare,
  2. Choose Compare Two Selected Cells from the right-click menu.

The values are compared and shown the same way as when comparing text data, with the exception that editing is disabled.