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

SAP Sybase SQL Anywhere 16.0 » MobiLink - Server Administration » MobiLink server technology » Synchronization techniques » Unique primary keys » GLOBAL AUTOINCREMENT

 

Using GLOBAL AUTOINCREMENT columns

You can set the default column value to be GLOBAL AUTOINCREMENT to maintain unique values.

Prérequis

There are no prerequisites for this task.

Contexte et remarques

Care must be taken to set the correct size of the range for your needs. Exhausting a range is possible, but you can detect this and assign a new range. See How default values are chosen.

 Task
  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 DEFAULT GLOBAL AUTOINCREMENT.

  2. Set the global_database_id value.

    SQL Anywhere and UltraLite databases supply default values in a database only from the partition uniquely identified by that database's number. For example, if you assign a database the identity number 10 and the partition size is 1000, 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 Global database IDs.

Résultat

The column is set as a GLOBAL AUTOINCREMENT column.