How can I set up a database that generates numbers based on imput

D

dogbadger

i am trying to generate uniquie numbers for a bunch of PC ID's. These numbers
should be based on a few variables like location state, city. Any help?
 
R

Rick B

Please tell us SPECIFICALLY what you want to do.

You want to enter what information? You wish to have it generate a number
in what format based on that information? Is this to be stored, or just
displayed for the user? Should it be sequential, but start over for each
state/city/etc?
 
P

Pat Hartman\(MVP\)

It is really poor practice to create "meaningful" IDs. At some point they
tend to fail due to the inability to create a unique ID in a case you
haven't considered. Once that happens, the ID is no longer "meaningful".
 
J

John Vinson

i am trying to generate uniquie numbers for a bunch of PC ID's. These numbers
should be based on a few variables like location state, city. Any help?

I have to agree with Pat. Combining data from multiple fields,
encoding it somehow, and storing it redundantly in a new field is NOT
a good idea. Such a field is called an "Intelligent Key" - and that's
not a compliment! They're hard to maintain, and rarely provide any
benefit that cannot be attained by using a simple surrogate key such
as an autonumber.

John W. Vinson[MVP]
 
P

Pat Hartman\(MVP\)

And I forgot to mention that "Intelligent Keys" violate all of the first
three normal forms!!
1. The field is not atomic
2. The parts of the key contain redundant data
3. Columns of the table are not dependent on the entire key
 
J

John Vinson

And I forgot to mention that "Intelligent Keys" violate all of the first
three normal forms!!
1. The field is not atomic
2. The parts of the key contain redundant data
3. Columns of the table are not dependent on the entire key

Or as I learned back in my first relational database class:

"I swear to base each field on the Key, the whole Key, and nothing but
the Key, so help me Codd!"

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top