Custom schema mapping

When you create a new schema comparison project and select your data sources, Schema Compare automatically maps objects with the same name and schema for you.

In case you need to compare objects having the same name, but belonging to different schemas, you can map the schemas as the circumstances require. For example, if you want to compare objects in a test database that are owned by HR with objects in a production database that are owned by Staff, you can map HR to Staff.

Edit schema mapping

You can edit mappings on the Schema Mapping page of the New Schema Comparison wizard.

Schema Mapping

  • To undo all mapping, click Clear All Mapping.
  • To undo one specific mapping, click a drop-down list under a schema name and select the required option.

Undo Mapping

  • To add a new schema mapping, click the empty row at the end of the list and select a source schema from the drop-down list. Then select a target schema from the corresponding target drop-down list.

New Mapping

  • To reset the mapping to default, click Restore Default Mapping.

Many-to-one schema mapping

You can map multiple source schemas to one target schema on the Schema Mapping tab of the New Schema Comparison wizard. To do that, use the Target schema drop-down list to select the same target schema next to each source schema that you want to map.

Many-to-One Schema Mapping

The mapping results will be similar to the following.

Many-to-One Schema Mapping

One-to-many schema mapping

You can similarly map one source schema to multiple target schemas on the Schema Mapping tab of the New Schema Comparison wizard. This process involves two possible cases.

Case 1: Your source tables are present in the target schema

This is the simpler case of the two, where you need to use the Source schema drop-down list to select the same source schema next to each required target schema.

One-to-Many Schema Mapping

Case 2: Your source tables are absent from the target schema

This is the more complex case where you will need to avoid unwanted table duplication.

1. Use the Source schema drop-down list to select the same source schema next to each required target schema.

One-to-Many Schema Mapping

2. Click Compare. In the resulting comparison document, you will see that the previously absent tables will be created in all target schemas after the synchronization.

3. In order to avoid unwanted table duplication, you can use filtering.

For example, we are mapping a schema called Sales to three different schemas (Sales_dev, Sales_Sandbox, and Sales_Test). Additionally, we want a table from Sales to be mapped only to Sales_dev. To do that, we enter the table name in the filter text box and clear the checkboxes next to Sales_Sandbox and Sales_Test to exclude them from mapping. Thus we will not get any unwanted duplicates.

Remove Duplicates

4. When you filter out all the unwanted duplicates, you will get a result similar to the following.

Configured Mapping

Note

If you don’t filter out the unwanted duplicates, you will most likely have to delete them later on, which is going to be more time-consuming.

5. Go to the Comparison menu > Synchronize to open the Schema Synchronization Wizard. Configure additional synchronization options, if necessary, and click Synchronize.

Compare only mapped schemas

To compare only the schemas that have been mapped automatically, you can use the Compare only mapped schemas option, which can be enabled by selecting the corresponding checkbox on the Schema Mapping tab of the New Schema Comparison wizard.

Configured Mapping

Thus, with the option enabled, all unmapped schemas will be excluded from the comparison.

The mapping results will be similar to the following.

Mapping Results

Want to Find out More?

Overview

Overview

Take a quick tour to learn all about the key benefits delivered by dbForge Schema Compare for SQL Server.
All Features

All features

Get acquainted with the rich features and capabilities of the Schema Compare in less than 5 minutes.
Request a demo

Request a demo

If you consider employing the Schema Compare for your business, request a demo to see it in action.
Ready to start using dbForge Schema Compare for SQL Server?