2 Primary Keys + AutoNumber field help

EPD Hater

Registered User.
Local time
Yesterday, 20:28
Joined
Mar 30, 2003
Messages
50
I have a table that will have data imported to it. Preferably, my primary key will be "ExtractDate", but there will be many items extracted for one day, so I would like an additional primary key "Seq". This seq field could be an AutoNumber field, but it will still continue with its incremental value even though the ExtractDate will have changed. I want my table to look like this:

ExtractDate Seq

06/22/2003 1
06/22/2003 2
06/22/2003 3
06/29/2003 1
06/29/2003 2
07/06/2003 1
07/06/2003 2 etc...

How can I pull this off, even when I'll be importing this data? Maybe I'll just have to have SAS (which is compiling the file) give the aformentioned sequence...

Thanks
 
In Table Design view, select the two fields you'd like to be the composite key and right click, selecting the primary key option.

The autonumber won't work the way you want it to, though.
 
I'm trying to do something very similar, except I'm not importing data, but need to do it to make it easier on the users.

Isn't there a way to make the "seq" field increment by one based on the changing value of the date field?
 
I'm going to go ahead and just compare what I want to do with how our DB2 tables work...Some tables have 7 primary keys, where 5 of them are sequence numbers, being unique within it's higher sequence number, and repeat when a new higher sequence number is achieved.

Sounds like VBA must be used to achieve this anyway...
 

Users who are viewing this thread

Back
Top Bottom