Selecting tables and views
Published 21 August 2019
When you create a project and you have selected your data sources, you can specify which tables, views, and columns to compare. SQL Data Compare automatically maps tables and views with the same name and schema (owner).
However, if there are schema differences between the data sources, for example if two tables have different names, they may not be mapped automatically.
You enter this information using the Tables & Views tab on the Project Configuration dialog box.
The Tables & Views tab enables you to:
- map tables and views
- select the comparison key for each table or view
- select the tables and views that will be compared
- map specific columns
- select the columns that will be compared
SQL Data Compare lists the tables and views in the source and target. Tables and views with identical or similar names are displayed side-by-side:
The upper pane displays tables and views that are fully Mapped or have Partial mapping. The lower pane displays Unmapped tables and views.
Note that:
- You can filter the specific rows that will be compared by entering a WHERE clause. Filtering can improve the performance of SQL Data Compare.
To filter rows, click WHERE Clause. The WHERE Clause Editor dialog box is displayed.
For more information, see Filtering the comparison results with a WHERE clause - Views are listed only if the data source is a database and the project option Include views is selected.
- You can change the order in which the tables and views are listed by clicking a column header.
To sort by multiple columns, click a column header, then hold down SHIFT and click another column header. - If you are editing an existing project and the structure of the database has changed since you last ran the project, the mappings may be incorrect. In this case, a warning symbol is shown to indicate that those changes affect your project configuration.
For more information, see Mapping errors - If the differences between objects are not significant, they are more likely to be automatically mapped if you select the options Ignore case of object names, Ignore spaces in object names, and Ignore underscores in object names
Mapping tables and views
To map tables and views:
- On the Tables & Views tab, select an Unmapped table or view that you want to map from the source database.
- Select the Unmapped table or view that you want to map from the target database.
- Click Map.SQL Data Compare moves the tables or views to the upper pane.
Note that if the tables and views that you are mapping contain columns with incompatible data types, SQL Data Compare cannot compare those columns; the column mapping shows the incompatible data types as Uncomparable and a warning symbol is shown in the Tables & Views tab.
For more information, see Which data types can be compared?
To unmap tables and views:
- On the Object mapping tab, select a Mapped table or view, or a Partial mapping.
- Click Unmap.
SQL Data Compare moves the tables or views to the lower pane.
Selecting the comparison key
To match rows in the two data sources, SQL Data Compare requires a comparison key for each table or view.
For more information about comparison keys and to see the conditions for automatic selection, see What's a comparison key?
If SQL Data Compare is unable to identify a suitable comparison key for a table or view, Not Set is shown in the Comparison Key box.
To set the comparison key for an object, click its Comparison Key in the left hand column. A dialog box is displayed on which you can select the columns that will comprise the key:
For large databases, specifying a clustered index as the comparison key can result in improved performance.
Selecting the tables and views
Select the tables and views you want to compare by selecting or clearing the appropriate check boxes in the Compare column.
By default, the first time that you run a project all tables and views with identical or similar names are selected for comparison.
If the structure of the data sources you are comparing has changed while you are working on the project, click Refresh to update the Tables & Views tab. For example, if a table has been added to the database, click Refresh so that you can include the new table in the comparison.
If a table or view has been added to a database since you last ran the project, SQL Data Compare does not select the table or view by default.
Mapping specific columns
If you want to compare columns in a table or view and the column names are different, you can map the columns as required.
To map columns:
- On the Tables & Views tab, click the Columns in Comparison box of a Partial mapping. A dialog box is displayed. For example:
- Select an Unmapped column that you want to map from the source database.
- Select an Unmapped column that you want to map from the target database.
- Click Map.
SQL Data Compare moves the columns to the upper pane of the dialog box. - Click Close.
Selecting columns
SQL Data Compare displays the number of columns that will be compared for each table or view. By default, the first time that you run a project, all columns with identical or similar names are selected for comparison.
You can filter the comparison to consider only specific columns.
To select the columns to compare in a table, click on it in the Columns in Comparison column. A dialog box is displayed with check boxes to include or exclude each column:
You cannot exclude any columns that are used for the comparison key.
A warning symbol is shown when columns you are comparing cannot be mapped. This occurs if those columns have:
- column names that do not match
- incompatible data types
- you can compare a timestamp column with another timestamp column, but you can't deploy timestamp columns.
- you can compare an xml column with another xml column, but you must make sure that your XML schemas are compatible.
For more information about the data types that SQL Data Compare can compare, see Which data types can be compared?