使用 WITH ERKEY 关键字创建 ERKEY 影子列,它可以被 Enterprise Replication 用作复制键。
ERKEY 影子列(ifx_erkey_1 、ifx_erkey_2 和 ifx_erkey_3)是可见的影子列,因为它们可以被索引且能在系统目录表中查看。在创建 ERKEY 影子列之后,会在使用这些列的表上创建新的唯一索引和唯一约束。Enterprise Replication 使用此索引作为复制键。
SELECT * FROM tablename;
SELECT ifx_erkey_1, ifx_erkey_2, ifx_erkey_3 FROM customer;
在以下示例中,ERKEY 影子列添加到 customer 表中:
CREATE TABLE customer (id INT) WITH ERKEY;