Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SCAN Confused?
Message
De
06/06/2001 09:49:08
Carol Dewar
Magram Computer Services Llc
Saugerties, New York, États-Unis
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
SCAN Confused?
Divers
Thread ID:
00515720
Message ID:
00515720
Vues:
58
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform