| Author |
How to generate Fixed length Sequences ?
|
shukla raghav
Ranch Hand
Joined: Aug 03, 2008
Posts: 182
|
|
I want my primary key to be fixed length and it must ahev a format like
- first three characters must be Alphabets that represent the initials of a country like LON, FRA, ITL, JAP, IND etc
- Next seven characters must be unique numbers generated by the sequence.
but the sequence does not generate numbers in fixed length format. what do i do, i dont want to do too much processing for just creating a meaningful primary key.
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
Why does the key need to be meaningful? The only safe primary key will have meaning to the database, nothing else. Could you not just make your seven digit field a surrogate key and stick a unique index on both fields?
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
Agador Paloi
Ranch Hand
Joined: Jan 24, 2006
Posts: 114
|
|
I would agree with Paul . Maybe have your country code as a seperate column from your sequence.
Agad
|
 |
shukla raghav
Ranch Hand
Joined: Aug 03, 2008
Posts: 182
|
|
|
I understand and thanks alot
|
 |
 |
|
|
subject: How to generate Fixed length Sequences ?
|
|
|