Examples of Wildcard Expressions for Table and Column Mappings
Review the following examples to learn how to define table and column mappings for different apply modes based on wildcard expressions. You define the mappings in the
Wildcard Mapping
dialog box.
Map the following source tables and columns to Microsoft SQL Server target tables and columns in SQL Apply mode:
TABLE1 on the source and dbo.TABLE1_TGT on the target.
COL1 on the source and COL1 on the target.
COL2 on the source and COL2 on the target.
TABLE2 on the source and dbo.TABLE2_TGT on the target.
COL1 on the source and COL1 on the target.
COL2 on the source and COL2 on the target.
The SQL Server target table names include the owner name dbo and the suffix _TGT.
Complete the following steps:
In the
Mapping Method
field, select
SQL Apply
.
In the
Source Table
field, enter the
*
wildcard only.
In the
Target Tables
field, enter dbo.
*_TGT
to select all target tables of the dbo owner with table names that end with the _TGT.
In the list box at the bottom of the
Wildcard Mapping
dialog box, the Data Replication Console matches TABLE1 to dbo.TABLE1_TGT and matches TABLE2 to dbo.TABLE2_TGT.
To map these tables, click
Map
.
You do not need to enter wildcard expressions for the column mappings because the source and target tables have identical column names.
Map the following source and target tables and columns in Merge Apply mode:
TABLE_SRC_1 on the source and TABLE_TGT_1 on the target.
COL_SRC_1 on the source and COL_TGT_1 on the target.
COL_SRC_2 on the source and COL_TGT_2 on the target.
TABLE_SRC_2 on the source and TABLE_TGT_2 on the target.
COL_SRC_1 on the source and COL_TGT_1 on the target.
COL_SRC_2 on the source and COL_TGT_2 on the target.
Use wildcard expressions for both the table and column mappings.
Complete the following steps:
In the
Mapping Method
field, select
Merge Apply
.
In the
Source Tables
field, enter
*SRC*
to select all source tables with table names that include SRC in the middle of the names.
In the
Target Tables
field, enter
*TGT*
to select all target tables with table names that include TGT in the middle of the names.
The Data Replication Console matches TABLE_SRC_1 to TABLE_TGT_1 and matches TABLE_SRC_2 to TABLE_TGT_2.
In the
Source Columns
field, enter
*SRC*
.
In the
Target Columns
field, enter
*TGT*
.
In the list box at the bottom, double-click the TABLE_SRC_1 row to view column matches. Then view columns matches for TABLE_SCR_2 in the same way.
Click
Map
.
Map the following source tables to the target audit log tables in Audit Apply mode. The source and target table names have different prefixes, and the target audit log table names include the _LOG suffix that is specified on the
Runtime Settings
tab >
Calculated Columns
view.
SRC_TABLE1 on the source and TGT_TABLE1_LOG on the target.
COL1 on the source and a pair of COL1_NEW and COL1_OLD columns on the target.
COL2 on the source and a pair of COL2_NEW and COL2_OLD columns on the target.
SRC_TABLE2 on the source and TGT_TABLE2_LOG on the target.
COL1 on the source and a pair of COL1_NEW and COL1_OLD columns on the target.
COL2 on the source and a pair of COL2_NEW and COL2_OLD columns on the target.
Complete the following steps:
In the
Mapping Method
field, select
Audit Apply
.
In the
Source Table
field, enter
SRC*
to select all source tables with table names that begin with SRC.
In the
Target Tables
field, enter
TGT*
to select the audit log tables with table names that begin with TGT and end with the suffix _LOG.
The Data Replication Console matches SRC_TABLE1 to TGT_TABLE1_LOG and matches SRC_TABLE2 to TGT_TABLE2_LOG.
To map these tables, click
Map
.
Map the following source and target tables and columns in SQL Apply mode. The tables have identical table names, but the columns have different column names.
TABLE1 on the source and TABLE1 on the target.
COL1_SRC on the source and COL1_TGT on the target.
COL2_SRC on the source and COL2_TGT on the target.
TABLE2 on the source and TABLE2 on the target.
COL1_SRC on the source and COL1_TGT on the target.
COL2_SRC on the source and COL2_TGT on the target.
Use wildcard expressions for both the table and column mappings.
Complete the following steps:
In the
Mapping Method
field, select
SQL Apply
.
In the
Source Table
and
Target Tables
fields, enter
*
to map source and target tables that have identical names.
The Data Replication Console matches the TABLE1 source table to the TABLE1 target table and matches the TABLE2 source table to the TABLE2 target table.
In the
Source Columns
field, enter
*SRC
.
In the
Target Columns
field, enter
*TGT
.
In the list box at the bottom, double-click the TABLE1 row to view column matches. Then view column matches for TABLE2 in the same way.
To map these tables, click
Map
.
Map the following source and target tables and columns in SQL Apply mode:
SRC_TABLE1_GRP1 on the source and GROUP1_TABLE1_TGT on the target.
COL1 on the source and COL1 on the target.
COL2 on the source and COL2 on the target.
SRC_TABLE2_GRP3 on the source and GROUP3_TABLE2_TGT on the target.
COL1 on the source and COL1 on the target.
COL2 on the source and COL2 on the target.
Complete the following steps:
In the
Mapping Method
field, select
SQL Apply
.
In the
Source Tables
field, enter
SRC_*_GRP*
.
In the
Target Tables
field, enter
GROUP$2_$1_TGT
.
The $2 wildcard matches against the capturing group that is represented by the second asterisk in the
Source Tables
field, which is a group ID. The $1 wildcard matches against the capturing group that is represented by the first asterisk, which is a table ID. As a result, the target table matching strings contain the group and table IDs in the reverse order from the source matching strings.
Based on these source and target expressions, the Data Replication Console matches SRC_TABLE1_GRP1 to GROUP1_TABLE1_TGT and matches SRC_TABLE2_GRP3 to GROUP3_TABLE2_TGT.
Click
Map
.
You do not need to enter wildcard expressions for the column mappings because the source and target tables have identical column names.