AUTO NUMBER

Is there anyway I can create auto-number columns in DB2, Like we do in access
LVL 4
claracruzAsked:
Who is Participating?
 
Kent OlsenConnect With a Mentor Data 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.