Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Substr() not working correctly
Message
De
16/09/1999 16:45:14
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00265612
Message ID:
00265659
Vues:
17
If you are using the code EXACTLY as below, and there are no indexes active on store, then it will work.

If you are doing a scan for ... and store is in the for condition, there is a chance it will fail.

replace all store with substr(alltrim(store), 2) should also work no matter what (unless there is a filter)

If these things still don't work, there may be a problem with your indexes. Rebuild all your indexes and try again.

Good luck!

ps, try select store, substr(alltrim(store), 2) from pnltemp to preview the replace all command above!

>>I have a table called pnltemp. The store column is defined as CHAR(4). I am wanting to scan through the entire table and strip off the leading character. I am using the following code, but for some reason it is not working properly (does it for maybe 4 of the 70 entries):
>>
>>
>>SELECT pnltemp
>> SCAN
>> store2 = substr(alltrim(store),2,3)
>> REPLACE store with store2
>> ENDSCAN
>>
>>
>>
>>PLEASE HELP!!!!
>
>Providing the leading character is always the left most character, try:
>
>Store2 = RIGHT(Store, 3)
>
>Even better try:
>SELECT pnltemp
>REPLACE ALL Store WITH RIGHT(Store, 3)
>
>but only if you test it first!
--Todd Sherman
-Wake Up! Smell the Coffee!
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform