Create Multiple Replication Definitions Per Table

You can create multiple replication definitions for the same primary table and customize each one so that it can be subscribed to by a replicate table whose characteristics are different from those of the primary table or from other replicate tables.

For example, you can create two separate replication definitions for the same primary table, one that replicates columns A and B, and another that replicates columns C and D. Each subscribing site receives only the columns that it needs as illustrated in the "Using Multiple Replication Definitions from One Primary Table" figure.

Using Multiple Replication Definitions from One Primary Table
Figure 9-1 illustrates multiple replication definitions from one primary table. It consists of a primary database table with four columns, A, B, C, and D. It also has two replication definition, rep def underscore A and rep def underscore B. Each replication definition is customized so that it can be subscribed to by a replicate table whose characteristics are different from those of the primary table or from other replicate tables. rep def underscore A replicates columns A and B, and rep def underscore B replicates columns C and D.  Replicate database 1 has table underscore 1 with A and B columns, and table underscore 2 with C and D columns from both rep def underscore A and rep def underscore B. Replicate database 2 has table underscore 3, which also has C and D columns from rep def underscore B. Each subscribing site receives only the columns that it needs.

In addition to describing the primary table, each replication definition can specify a smaller number of columns, different column names, different published datatypes, or a different table name for a replicate table. Replicate tables that match the specified characteristics can subscribe to the replication definition.

Different replication definitions created for the same primary table must use the same declared column datatype (unless the datatype is rawobject or rawobject in row) and the same null and not null status for text, unitext, and image columns. Use alter replication definition to alter a column’s datatype or null status.

You can change replication status using alter replication definition. For example, you can change the replication status of text, unitext, and image columns from replicate_if_changed to always_replicate. The replication status for the column will also change for other replication definitions for the same primary table.

Related concepts
Alter Column Datatypes