KS DB Merge Tools logo KS DB Merge Tools
Documentation
MssqlMerge logo for SQL Server
aka MssqlMerge
KS DB Merge Tools for Oracle logo
KS DB Merge Tools for MySQL logo
KS DB Merge Tools for PostgreSQL logo
KS DB Merge Tools for SQLite logo
AccdbMerge logo
KS DB Merge Tools for Cross-DBMS logo

Query Result Diff Tab

  • Opened from:
  • Applicable tab-specific toolbar actions:
    • Export to Xlsx or Json
    • Generate automation script stub for query result diff (with LogTo(), DbOpen() and DataDiff() statements relevant for the current query; query itself must be saved to the diff profile)
    • Copy selection to clipboard
    • Show all, new and changed, new, changed, unchanged rows
    • Jump to the last, next, previous, first change
    • Select all, none, invert selection on the left, all, none, invert selection on the right side
  • Applicable object types: Tables, Views, Stored procedures, any database query

This tab allows to compare arbitrary query results:

for SQL Server, query result diff tab

Vertical toolbar between two panels contains additional tab-specific actions:

  • 'Column mapping' opens Custom data diff dialog to specify key columns, which columns to show and how to map them if you want to compare columns with changed names
  • Ignore case (for the text data)
  • Ignore leading and trailing whitespaces (for the text data, this option also makes NULL and empty string to be considered as equal)

Important note: Along with providing result, your query can do data modification - for example you can create or delete tables. Be sure that your query does not perform any undesired deletions or modification. Application does not do any query text validation, it is forwarded to the database(s) as is.

This tab is very similar to Data diff with three principal differences:

  • Data diff compares only one table with all rows, here you can specify any query yourself
  • Query can return more than one resultset (it can be stored procedure call that returns many resultsets, or just multiple SQL statements). All these resultsets are saved in application memory after execution. There is no paging like in Data diff, where you can fetch rows from DB by portions. Each time you switch show all/new/changed rows - Data diff fetches new result from server, but Query result diff uses resultsets from memory
  • Query results from this tab can not be merged, only compared

Top panel contains:

  • Run action, which is also available by F5 keyboard shortcut
  • Three keys&columns mapping options. 'Basic key column mapping' option shows Query key columns dialog to define key columns only. 'Customize key & data column mapping' shows Custom data diff dialog to setup both keys and rest of columns mapping
  • 'Split query' option will split query text in two parts, so that you can compare two different query results
  • 'Run both against the same DB' option make sense only in 'Split query' mode. It allows you to compare two different query results for the same database

All these options are available with Alt and action key from the keyboard. Action key is underlined when you hit the Alt key. So, for example Alt+S shortcut switches 'Split query' option

Results top panel contains:

  • Resultsets control (on the right side), which becomes active when your query returns more than one resultset
  • Changes summary for each side: total, new, changed and new+changed row count, selected row count if any row is selected
  • Query execution time measured on application side

Main results data grid has a row selection checkbox nearby - so you can select the number of rows with the mouse or with the Space button from the keyboard and do export of selected rows only. This data grid also allows column sorting with clicking on the column name.

Results bottom panel shows selected line from both sides, providing easier comparison of changed values.

Option Save to diff profile is available if the Home tab has loaded diff profile. This option allows you to re-open this query from Diff profile editor tab, without needing to type query text and specify mappings again. Note that basic mappings are saved as Custom mappings, non-key column mappings are auto-specified by column name and type on Run. If a query is opened from the diff profile and mappings are no longer unique then application may ask to define mappings again.

Free version limitations:

  • The whole tab is not available

Last updated: 2024-10-21