Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using sys(2015) for Unique keyvalues ?
Message
From
16/08/2003 09:10:03
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
15/08/2003 19:57:56
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00820691
Message ID:
00820738
Views:
16
>I am trying to decide whether to use sys(2015) to generate a unique primary key value for a table in one of my applications. In this particular case there would be less overhead, and it would be quicker and more simple than getting a 'next number' from a table that stores the next key value.

I didn't have problems with speed, getting a "next number" from a table. However, I didn't do exhaustive speed tests.

If you need it, I can post a copy of my SerialNumber() function.

For disconnected machines or networks, you could combine this with a MachineId or BranchId, which you assign.

An advantage of this method is the size of the keys. The serial number by itself uses 4 bytes. If you combine it with a BranchId, you would probably need 6 bytes, with an expression similar to bintoc(BranchId,2) + bintoc(SerialNumber()).
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
Reply
Map
View

Click here to load this message in the networking platform