Replicating computed columns

The CDC Replication Engine for Microsoft SQL Server can replicate data in computed columns.

When replicating computed columns, consider the following:

  • Computed columns are read from the database at the time of replication. Therefore, only the current image of a computed column field in a source table will be sent at the time of replication.
  • You cannot reference computed columns in row-filtering expressions.
  • You cannot reference computed columns in an expression defined for a derived column.
  • If the computed column is a LOB, then all the LOB considerations apply.

Replicating data to a table with computed columns

CDC Replication can replicate data from a source table to a target table that contains computed columns. If your target table contains computed columns, map the initial value as Database Default in Management Console. All the other columns can be mapped to source columns.

When replicating data to tables containing computed columns, consider the following:

  • You cannot obtain the value of computed columns in the target database with CDC Replication. CDC Replication skips the column that is mapped to Database Default on the target when applying data.
  • You cannot define computed columns as key columns in a target table.
  • You cannot reference computed columns from the target in a derived expression.
  • User exits cannot access the data for any computed columns on the target.
  • isDataAvailable(int) in the CDC Replication API can be used in a user exit to determine if there is data for a specific column. This method will return false for target computed columns. An exception is thrown if you attempt to retrieve the value from a column that is mapped to a target computed column.