The IDENTITY or AUTOINCREMENT Default

The IDENTITY/AUTOINCREMENT default is useful for numeric data fields where the value of the number itself may have no meaning.

The feature assigns each new row a value of one greater than the current highest value in the column. You can use IDENTITY/AUTOINCREMENT columns to record purchase order numbers, to identify customer service calls or other entries where an identifying number is required.

Autoincrement columns are typically primary key columns or columns that are constrained to hold unique values (see CREATE TABLE statement in Reference: Statements and Options). For example, autoincrement default is effective when the column is the first column of an index, because the server uses an index or key definition to find the highest value.

You can sometimes retrieve the most recent value inserted into an autoincrement column using the @@identity global variable.

SAP Sybase IQ does not support the special value GLOBAL AUTOINCREMENT.

The initial IDENTITY/AUTOINCREMENT value is 0 when the table is created, and works only with positive integers.

A column with the AUTOINCREMENT default is referred to in Transact-SQL applications as an IDENTITY column. SAP Sybase IQ supports both keywords.