Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do you extract parts of a string in a field?
Message
De
21/12/2000 09:26:34
 
 
À
21/12/2000 08:49:13
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00455835
Message ID:
00455862
Vues:
28
Hi Joe,

There are a few ways of doing this but the easiest is as follows :

Replace field with '95' + substring(field,3) for Left(field,2) ='50'
This will replace all the records in the table matching the criteria - but beware if your table is in a multi user enviornment this will cause record locking contention.
Also, if it is a large table then this will not be particularly fast (unless you have an index key on Left(field,2))

Or...
Update tableName ;
Set field = '95' + substring(field,3) ;
Where Left(field,2) = '50'

or..... etc.

Cheers
Will

Hi All! How do you extract certain parts of a string. Like I want to replace the first three digits of a field with something. ie. 50-1020 with 95-1020
Anything that begins with 50- I want to replace it with 95-

Thanks in advance for your help!
Will Jones
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform