Contents Index Maintaining unique primary keys using UUIDs Declaring default global autoincrement

MobiLink Synchronization User's Guide
  Synchronization Techniques
    Maintaining unique primary keys

Maintaining unique primary keys using global autoincrement


In Adaptive Server Anywhere and UltraLite databases, you can set the default column value to be GLOBAL AUTOINCREMENT. You can use this default for any column in which you want to maintain unique values, but it is particularly useful for primary keys.

To use global autoincrement columns

  1. Declare the column as a global autoincrement column.

    When you specify default global autoincrement, the domain of values for that column is partitioned. Each partition contains the same number of values. For example, if you set the partition size for an integer column in a database to 1000, one partition extends from 1001 to 2000, the next from 2001 to 3000, and so on.

    See Declaring default global autoincrement.

  2. Set the GLOBAL_DATABASE_ID value.

    Adaptive Server Anywhere supplies default values in a database only from the partition uniquely identified by that database's number. For example, if you assigned the database in the above example the identity number 10, the default values in that database would be chosen in the range 10001-11000. Another copy of the database, assigned the identification number 11, would supply default value for the same column in the range 11001-12000.

    See Setting the GLOBAL_DATABASE_ID value.

For more information 

This section describes how to use global autoincrement columns in Adaptive Server Anywhere remote databases. For information on using global autoincrement columns in UltraLite databases, see Declaring default global autoincrement columns.

For information on how global autoincrement columns work in Adaptive Server Anywhere databases, see How default values are chosen. For information on how they work in UltraLite databases, see Declaring default global autoincrement columns.


Declaring default global autoincrement
Setting the GLOBAL_DATABASE_ID value
Setting unique database identification numbers when extracting databases
How default values are chosen

Contents Index Maintaining unique primary keys using UUIDs Declaring default global autoincrement