Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Primary key
Message
From
19/03/2003 07:44:29
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
19/03/2003 03:57:18
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00766466
Message ID:
00767443
Views:
19
>HI,
>Do you prefer to use Integer value or STR(Integer value) as primary key ?
>
>Thank you

To assure uniqueness in a single integer field, I would just create a candidate index on the single field - no str(), which would simply add overhead, which I believe is unnecessary in this case.

To assure uniqueness in any other single field, I would also use the field itself.


To ensure uniqueness among two or more fields, the simplest method is usually to everything to character, and concatenate (use "+" to combine the character expressions).

For integers, it turns out that bintoc() (VFP 5 or later) takes up much less space than str().

An example, involving a character, an integer, and a date:
index on MyCharacter + bintoc(MyInteger) + dtos(MyDate) tag MyIndex
dtos() is suitable for dates, since it is independent of the date format.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform