Primary key sequencing

Carl Nelson

Primary key sequencing

I have a table in which we would like to sequence within the
unique/PK occurrence. And of course I need an answer today.

For example:
Col-1 - PK
Col-2 - sequencing value within PK
Col-3 - non-key value

We would like for Col-2 to sequence starting with 1 for each unique
value of Col-1
Col-1 Col-2
AAA 1
AAA 2
AAA 3

BBB 1
BBB 2
BBB 3

Identity columns & sequence objects will not work. We could use
timestamp with default or do select max +1. But these we would
rather not do. Any ideas for Col-2?


Thanks
Carl Nelson
WellPoint Database Architecture
317-287-7222



CONFIDENTIALITY NOTICE: This e-mail message, including any attachments,
is for the sole use of the intended recipient(s) and may contain confidential
and privileged information or otherwise protected by law. Any unauthorized
review, use, disclosure or distribution is prohibited. If you are not the
intended recipient, please contact the sender by reply e-mail and destroy
all copies of the original message.

---------------------------------------------------------------------------------
Welcome to the DB2 User Group - Indiana list. To unsubscribe, go to the archives and home page at http://www.idugdb2-l.org/archives/DB2-UG-Indiana.html. From that page select "Join or Leave the list". The IDUG Listserv FAQ is at http://www.idugdb2-l.org. The DB2 User Group - Indiana List Admins can be reached at [login to unmask email] Find out the latest on IDUG conferences at http://conferences.idug.org/index.cfm