?
Solved

AUTO NUMBER

Posted on 2006-06-19
2
Medium Priority
?
411 Views
Last Modified: 2012-08-13
Is there anyway I can create auto-number columns in DB2, Like we do in access
0
Comment
Question by:claracruz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 46

Accepted Solution

by:
Kent Olsen earned 1000 total points
ID: 16935633
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
 
LVL 50

Expert Comment

by:Lowfatspread
ID: 16935968
also see SEQUENCE

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

Featured Post

How To Reduce Deployment Times With Pre-Baked AMIs

Even if we can't include all the files in the base image, we can sometimes include some of the larger files that we would otherwise have to download, and we can also sometimes remove the most time-consuming steps. This can help a lot with reducing deployment times.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

November 2009 Recently, a question came up in the DB2 forum regarding the date format in DB2 UDB for AS/400.  Apparently in UDB LUW (Linux/Unix/Windows), the date format is a system-wide setting, and is not controlled at the session level.  I'm n…
Recursive SQL in UDB/LUW (you can use 'recursive' and 'SQL' in the same sentence) A growing number of database queries lend themselves to recursive solutions.  It's not always easy to spot when recursion is called for, especially for people una…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses
Course of the Month8 days, 6 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question