Identity Columns

Identity columns provide a way to have DB2 automatically generate unique, sequential, and recoverable values for each row in a table. The new identity column is defined with the AS IDENTITY attribute provided in column definition. Each table can have only one identity column defined to it. Identity columns are ideally suited for the task of generating unique primary key values such as employee number, order number, item number, or account number. Identity columns can also be used to alleviate concurrency problems caused by application-generated sequence numbers.

An identity column value can be always generated by DB2 or by default. DB2 always generates the column value and guarantees its uniqueness for identity columns defined ...

Get DB2® Universal Database™ for OS/390™ v7.1 Application Certification Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.