Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SCAN Confused?
Message
From
06/06/2001 10:07:21
 
 
To
06/06/2001 09:49:08
Carol Dewar
Magram Computer Services Llc
Saugerties, New York, United States
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00515720
Message ID:
00515744
Views:
10
This message has been marked as a message which has helped to the initial question of the thread.
Not a good choice for a PK. It is possible that two users will generate the same key. There is an article on my web site that discusses PK generation.


>My officemate needed to add a primary key to an @10,000 record database.
>He added PKEY a DateTime field.
>He figured, since users add records by an Add button, then fill in the rest; Replacing PKEY with DATETIME() on add is fine. I wonder if that is enough.
>
>Anyway, after he added the field PKEY, he wrote a small prg to update the @10,000 records:
>
>USE Mtg EXCLUSIVE
>ldCount = {^2001-01-01 12:00:00AM}
>SCAN
>   REPLACE PKey WITH ldCount
>   ldCount = ldCount+1
>ENDSCAN
>
>
>When he tried to add a primary index on PKey, he got the uniqueness violated error.
>He is running VFP 6.0 SP5 and Win 2000 SP1.
>(This is from memory.)
>I queried the database, and found 26 PKey dups. Starting around record 92000, and about every 7th or 8th record thereafter; there was a dup, then a skip.
>
>I mean: RecNo             PKey
>        92008 {^2001-01-08 09:20:08AM}
>        92009 {^2001-01-08 09:20:08AM}
>        92010 {^2001-01-08 09:20:10AM}
>
>I fixed this by changing his prg to: REPLACE ALL PKey WITH ldCount+RECNO()
>But, I am wondering if anyone has encountered, or can explain this dupping.
>It is like the REPLACE and the var update got confused.
>
>Thanks in advance,
>Carol Dewar
>Magram Computer Services
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Previous
Reply
Map
View

Click here to load this message in the networking platform