Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Surrogate Primary Keys - Integer or Character ?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00397596
Message ID:
00397615
Views:
14
I can't think of a good reason to use a character data-type for a surrogate primary key. The integer data-type seems particularly well suited for surrogate primary keys, and you can always STR it if you need to concatenate it with another field. Using the STR of a numeric value for the key itself seems like unnecessary overhead.

I've still got some legacy apps that used SYS(2015) in a C(10) field as the surrogate primary key. This still works, but these days there's a real risk of duplicates with fast machines so I wouldn't use that approach in a new app.


>The only good reason I can think of to use a character based primary key is that it allows for the use of concatinated keys. This ability doesn't seem to out-weight the performance issues so why would I ever use a character based primary key? Am I missing the boat here? Is there some hidden advantage to it? If not, why do most all of the frameworks I have looked at default to it?
Rick Borup, MCSD

recursion (rE-kur'-shun) n.
  see recursion.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform