AQT can generate a script to resynchronize the contents of the two tables. Options for this are specified on the Script Options tab:
In the Generate Script box you can specify whether:
File specifies the name of the script file that AQT will generate.
Show file when compare completes specifies whether the script file is to be shown once the script completes.
Note: when generating Update and Insert statements, AQT will only include the columns which are being compared. If you exclude a column from the compare, it will not be included in the Update / Insert. Because no matching column has been specified, AQT is unable to know what value to use for the Update / Insert.
If you are comparing Queries, you can only generate a resync script if it is an Updateable Query. This is one which:
These options specify which SQL statements to include in the script. These allow you to control what categories of changes are to be applied to the target table.
By default AQT will include update, insert and delete statements. You may only wish to de-select deletes, for instance, if you only want updates and inserts applied to the target table/
Generate Updates as Delete / Inserts. When this option is selected, AQT will generate an update statement as a delete followed by an insert. This is useful in circumstances when foreign key relationships on a table prevent an update from happening. In this case a delete/insert may work more successfully.
When this option is used, deletes and inserts statements will be created even if the insert and delete options are de-selected. The delete/insert can be considered as an update.
These options allow you to perform a bi-directional resync, which can be useful in some circumstances. For instance you might have an environment where rows are added to two tables in different databases and/or sites, and deletes/updates are not done. You may wish to resync the tables so they both contain all the rows. This requirement can be difficult to achieve by other means, however is easy with the Data Compare:
After this, both tables will then have all the rows.
By default, the resynchronization script will have all the SQL statements in a single file.
Sometimes it can be useful to have the Update / Insert / Delete statements in separate files - this is can be needed if you are resynchronizing a set of tables that have foreign keys defined between them. In this case the update / inserts / deletes for the various tables have to be run in a particular order.
To do this, go to the More Options tab and click on Generate Updates, Inserts, Deletes to separate files. AQT will write the update, insert, delete statements to the specified files, as well as to the "main" resynchronization script file.
When this option is selected, AQT will only write to the three update/insert/delete files, and not to the main script file.