Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 12.0.0 (Français) » SQL Remote » Creating SQL Remote systems » Duplicate primary key errors » Using primary key pools


Create a primary key pool table

 ♦  To create a primary key pool table (SQL)
  1. On the consolidated database, execute the following statement to create a primary key pool table:

    CREATE TABLE KeyPool (
       table_name VARCHAR(128) NOT NULL,
       value INTEGER NOT NULL,
       location CHAR(12) NOT NULL,
       PRIMARY KEY (table_name, value),
    Column Description
    table_name Holds the names of tables for which primary key pools must be maintained. For example, if new sales representatives are added only on the consolidated database, only the Customers table needs a primary key pool and this column is redundant.
    value Holds a list of primary key values. Each value is unique for each table listed in table_name.
    location An identifier for the recipient. In some systems, this can be the same as the rep_key value of the SalesReps table. In other systems, there are users other than sales representatives; in such systems, the two identifiers should be distinct.
  2. To increase performance, execute the following statement to create an index on the primary key table:

    CREATE INDEX KeyPoolLocation
    ON KeyPool (table_name, location, value);