Is it possible to use an alphanumeric ID like this for exemple : MSG01 or TOOL025? If so, what would be the advantages? What would be a typical scenario for such a use? If not, why not?
Yes, but remember Base is not a database, it connects to databases. So the “yes” may depend on your type of database…
IMHO none, except human readability.
Pre-existing labels, for example in libraries could be directly used as ID.
Ok! So it’s a personal choice, anything is possible as long as you know what you’re doing and what database you’re using it with.
Thanks Wanderer!
Example: electronic invoices. There are code-tables for measurement with more than 2000 rows. Primary key is a code VARCHAR(3). XPP
is key for piece
. XML-files only contain the XPP
.
For me the main decision is, if I wish to have an autoincremented Id. The other question would be, if it is useful to separate your code, maybe have onne column for MSG and a second for the Number and you can even add a third column for an autoincremented Id. Depends on use cases.
Thank you all for taking the time to enlighten me on this subject. I gather it’s possible, but if there’s another way, why risk complicating things?
While it is a personal choice, using alpha characters in a Primary key is rarely a wise choice.
They can come back to bite you, usually at the worst possible time and having to rebuild tables on the fly can be nerve wracking.
Computers only know how to deal with numbers, Alpha characters you understand must be converted to numbers for the computer and then they must be combined and compared to sort them then an index of Integers must be created. Why not just use an Integer for the Primary Key and let the Database Engine skip those other steps.
On a well designed Base Form the Primary Key is usually hidden from the user. Allowing the user to change a Primary Key is risky.