How to perform custom object mapping in ApexSQL Data Diff

Applies to
ApexSQL Data Diff

Summary
This article explains how to use the Object mapping feature in ApexSQL Data Diff to map the specific objects in a database for comparison and synchronization in SQL Server.

Description
Object mapping is used for a custom mapping of tables and indexed views with different names and schemas. By default, only tables are set as an object for comparison. To include both, tables and views as objects for comparison, in the Options tab, check the Tables and views option:

Tables and views option

Quick tip icon

Quick tip:

Tables and indexed views with the same names and schemas are automatically mapped

To open the Object mapping dialog, in the New project dialog, set the data sources (source and destination database), click the Show advanced options button, and select the Object mapping tab:

Object mapping

Quick tip icon

Quick tip:

The automatic mapping can’t be done for the objects that exist only in the source, or only in the destination data source

ApexSQL Data Diff will load and automatically map all objects with the same object and schema name:

Mapped columns

To change the lists of all automatically mapped tables or views, click on an appropriate tab:

Switch between Tables and Views tabs

Custom table mapping
There are two cases for performing the custom table mapping:

  1. To exclude automatically mapped tables or views from the comparison select objects in the list and click the Unmap button:

    Click the Unmap button

    Quick tip icon

    Quick tip:

    Press and hold CTRL to select multiple tables and unmap them at the same time

    The unmapped tables will appear in the unmapped records list:

    The unmapped tables will appear in the unmapped records list

    Furthermore, the user can unmap more tables and then map them as wanted:

    Figure illustrating how user can unmap more tables and then map them as wanted

  2. To compare and synchronize differently named SQL Server tables/views with the same schema names, select the tables/views from the unmapped record list, and click on the Map button:

    Mapping tables views with the same schema names

    The mapped tables will be presented in the mapped object list and included in comparison:

    The mapped tables will be presented in the mapped object list

    Quick tip icon

    Quick tip:

    To remove all custom defined object mapping, click the Apply default mapping button

Custom column mapping
Custom column mapping can be performed by selecting the Mapped columns cell for the particular object, and clicking the arrow button:

The Mapped columns cell

There are two cases for performing the custom column mapping:

  1. To exclude automatically mapped columns from the comparison select the columns in the list and click the Unmap button:

    Exclude automatically mapped columns from the comparison

    The unmapped columns will appear in the unmapped column list:

    The unmapped columns will appear in the unmapped column list

    Quick tip icon

    Quick tip:

    Unmapping the unneeded columns from the comparison and synchronization, can speed up the process

    Furthermore, the user can unmap more columns and then map them as wanted:

    Unmap more columns and then map them as wanted

  2. If differently named tables are custom mapped, and contain differently named columns the Mapped columns cell will not show any mapped columns:

    Mapped columns cell not showing any mapped columns

    To map columns with different names open the Object mapping dialog, select the columns and click the Map button:

    Select the columns and click the Map button

    Quick tip icon

    Quick tip:

    If the column names are the same, in differently named tables, by mapping tables the columns will be automatically mapped