[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 413
  • Last Modified:

AUTO NUMBER

Is there anyway I can create auto-number columns in DB2, Like we do in access
0
claracruz
Asked:
claracruz
1 Solution
 
Kent OlsenData Warehouse Architect / DBACommented:
Sure.  :)

In DB2 they're call "identity" columns.  Nothing more than an integer that increments (usually by 1) every time a row is inserted.  The column can be defined so that the insert must accept the value generated by DB2, or have DB2 generate a value only when a value isn't stored.


CREATE TABLE any
(
  AutoColumn integer not null identity;
...
);


Good Luck,
Kent
0
 
LowfatspreadCommented:
also see SEQUENCE

which version / edition  / OS are you using DB2/UDB with?
 
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now