Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to strip / delete leading zeros ...
Message
 
À
15/10/2009 15:38:49
Harold Leggett
Information Services Group
Louisville, Kentucky, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01429527
Message ID:
01429537
Vues:
79
>No, not running SET DECIMALS TO 0 ....
>
>I am converting from one DBF with a C(6) field equipcode containing values such as:
>
>2098
>0092
>3100
>2101
>2435
>
>In a SCAN / ENDSCAN ... REPLACE equipment WITH VAL(equipcode), where equipment is N10.0
>
>The results are:
>
>298
>92
>31
>211
>2435
>
>I thought I understood VAL as returning the Value of the character field, but it seems to be dropping all zeros ...
>
>Best,
>
>Harold ...

That works fine for me:
SET DECIMALS TO 17
CREATE CURSOR crsTest (CharField C(6), NumField N(10))
INSERT INTO crsTest (CharField) VALUES ("2098")
INSERT INTO crsTest (CharField) VALUES ("0092")
INSERT INTO crsTest (CharField) VALUES ("3100")
INSERT INTO crsTest (CharField) VALUES ("2101")
INSERT INTO crsTest (CharField) VALUES ("2435")

SCAN
   REPLACE NumField WITH VAL(CharField)
ENDSCAN
BROWSE NORMAL
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform