Order by table operation—%ORDERTAB

Use this function when you want CDC Replication to generate a monotonically increasing sequence value, incrementing for each operation received for a specific table in a subscription during mirroring or during refresh.

%ORDERTAB is a target-side derived expression. It provides a per-table sequence instead of a per-subscription sequence. The sequence value for %ORDERTAB starts at 1. It is of type "64-bit integer". It must be mapped to an SQL BIGINT column. When a table is refreshed, the first row that is inserted would have a %ORDERTAB value of 1, then 2, 3, and so on.

Rules on the use of %ORDERTAB
  • It can be used only as a target-side derived expression. It is not allowed to use it in a source-derived column.
  • It cannot be enclosed inside any other derived expression.
  • The data type of the target column it is mapped to must be BIGINT.
  • It can be used only for an SQL target, so it is not applicable for a Kafka or DataStage target.