Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do you extract parts of a string in a field?
Message
From
21/12/2000 09:26:34
 
 
To
21/12/2000 08:49:13
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00455835
Message ID:
00455862
Views:
27
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
Previous
Reply
Map
View

Click here to load this message in the networking platform