Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Indexing : Best Practice.
Message
 
 
To
05/06/2003 10:32:07
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00796703
Message ID:
00796721
Views:
16
>Based on your last message, how do you define your primary keys if you do not use compound indexes?
>
>Jason

All of my tables (without exception) have an integer that is used as the primary key - this is not unique across tables, but it would not take a great deal of effort to make it so. If new data is created at multiple (disconnected) locations, then I would use a GUID.

I prefer Integers, because if I need to delete a record, I just multiply the (normally) positive integer by -1 and make it negative. When I need to add a new record I first Select Top 1 iPrimaryKey From Table Where iPrimaryKey < 0 - if there are no rows returned, then I need to really create a new record and not reuse an old record. Reused records, simply have there primary key multiplied by -1 again, to return it to its original positive value.
censored.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform