Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using sys(2015) for Unique keyvalues ?
Message
 
 
To
15/08/2003 19:57:56
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00820691
Message ID:
00820693
Views:
17
Hi David,

The value returned by SYS(2015) is based on the system clock. It'll be unique on one PC but the same value maybe generated on different PC's. Download Convert SYS(2015) value back File #9704 to see details.

>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.
>
>In Visual Accountmate, a VFP accounting package I work with, in some cases they use sys(2015) to generate unique numbers in some of their line item tables. I haven't ever run into any problems with reliability with this, or heard of anyone else running into a problem. I've looked for dupes in Accountmate tables with hundreds of thousands of rows, and never encountered any.
>
>I've seen threads on here that talk about the reliability of using sys(2015) for temp file names - on fast computers etc. But I haven't seen any threads that address the issue of using it as a primary key.
>
>When I proposed that we use it for a new application, one of the other developers I work with questioned me on whether I could guarantee that it would be unique, every time it was called, and what algorithm it used to guarantee uniqueness. I couldn't give him an answer. I think that it is based in part on the date and time. Beyond that I don't know.
>
>Does anyone know the algorithm used to generate the sys(2015) string?
>
>TIA
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform