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

SQL Anywhere 10.0.1 » MobiLink - Client Administration » UltraLite Clients » Primary key uniqueness in UltraLite

Determining the most recently assigned GLOBAL AUTOINCREMENT value Next Page

Overriding partition sizes for autoincremented columns


The partition size is any positive integer, although the partition size is generally chosen so that the supply of numbers within any one partition will rarely, if ever, be exhausted.

For columns of type INT or UNSIGNED INT, the default partition size is 216 = 65536; for columns of other types the default partition size is 232 = 4294967296. Since these defaults may be inappropriate it is best to specify the partition size explicitly.

Default partition sizes for some data types are different in UltraLite applications than in SQL Anywhere databases. Declare the partition size explicitly if you want different databases to remain consistent.

To override UltraLite partition values (Sybase Central)
  1. Connect to the UltraLite database.

  2. Right click the selected column and click Properties from the popup menu.

    The Column property sheet appears.

  3. Click the Value tab.

  4. Enter any positive integer in the Partition Size field.

To declare autoincrement columns in UltraLite (Interactive SQL)
  1. Connect to the UltraLite database.

  2. Execute a CREATE TABLE or ALTER TABLE statement with a DEFAULT GLOBAL AUTOINCREMENT phrase with the partition size specified in parentheses immediately following the AUTOINCREMENT keyword. See UltraLite CREATE TABLE statement and UltraLite ALTER TABLE statement.

    For example, the following statement creates a simple reference table with two columns: an integer that holds a customer identification number and a character string that holds the customer's name. A partition size of 5000 is required for this table.

    CREATE TABLE customer (
       id   INT          DEFAULT GLOBAL AUTOINCREMENT (5000),
       name VARCHAR(128) NOT NULL,
       PRIMARY KEY (id)
    )
  3. See also