SQL Compare 11

Mapping tables and columns

When you have selected your data sources, SQL Compare automatically maps tables and columns with the same name in the source and target data sources.

However, SQL Compare also allows you to map together tables and columns with different names. This can be useful to prevent data loss when deploying tables or columns that have been renamed.

For example, if you map the table TableA in the source to the same table that has been renamed as TableB in the target, SQL Compare will compare the table as an object that exists in both data sources. When you deploy the table, the name change will be scripted using the sp_rename system stored procedure; the table is not dropped and re-created.

To compare tables and columns that are not automatically mapped, click the Table Mapping tab of the Project Configuration dialog box:

The upper pane displays tables that are fully Mapped or have Partial mapping. The lower pane displays Unmapped tables.

To set the column mappings for a table, click the Status link for the object you want to re-map.

If a table has a Partial mapping, some of its columns are not mapped, and cannot be compared.

Mapping tables

To map tables:

  1. On the Table Mapping tab, select an Unmapped table that you want to map from the source database.
  2. Select the Unmapped table that you want to map from the target database.
  3. Click  Map.
    SQL Compare moves the tables to the upper pane.

To unmap tables and views:

  1. On the Table mapping tab, select a Mapped table, or a Partial mapping.
  2. Click  Unmap.

SQL Compare moves the tables or views to the lower pane.

Mapping columns

If you want to compare columns in a table and the column names are different, you can map the columns as required.

SQL Compare automatically maps columns with different names that are:

  • the same data type
  • the same position in the column order

To map columns:

  1. On the Table mapping tab, click the Status box of a Partial mapping.
    A dialog box is displayed. For example:
  2. Select an Unmapped column that you want to map from the source database.
  3. Select an Unmapped column that you want to map from the target database.
  4. Click  Map.
    SQL Compare moves the columns to the upper pane of the dialog box.
  5. Click Close.

To unmap columns:

  1. On the Table mapping tab, click the Status box of a Mapped table or view, or a Partial mapping.
    A dialog box is displayed for you to specify the column mappings, as shown above.
  2. Select a Mapped column.
  3. Click  Unmap.
    SQL Compare moves the columns to the lower pane of the dialog box.
  4. Click Close.

Didn't find what you were looking for?