Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SCAN Confused?
Message
From
06/06/2001 09:49:08
Carol Dewar
Magram Computer Services Llc
Saugerties, New York, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
SCAN Confused?
Miscellaneous
Thread ID:
00515720
Message ID:
00515720
Views:
57
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
Carol Dewar
Magram Computer Services LLC
Next
Reply
Map
View

Click here to load this message in the networking platform