Replace substring in SQL

Forum for DBF Commander discussing.

Replace substring in SQL

Postby remex74 » Fri Nov 02, 2018 11:52 am

How can I change substring in a field with SQL commands?

I tried this:
UPDATE "xxx.dbf" SET field1 = REPLACE(field1, "FROMTHIS", "TOTHAT") where field1 like "%xy%"

I got this Error Message:
-> File 'replace.prg' does not exist

Thank you.
Posts: 1
Joined: Tue Oct 30, 2018 2:38 pm

Re: Replace substring in SQL

Postby Admin » Fri Nov 02, 2018 1:52 pm

Hi there,
use the STRTRAN() function:
Code: Select all
UPDATE xxx SET field1=STRTRAN(field1, 'FROMTHIS', 'TOTHAT') WHERE field1 LIKE '%xy%'
Best regards,
Oleg Zhechkov
User avatar
Site Admin
Posts: 123
Joined: Wed Apr 21, 2010 7:27 pm

Return to DBF Commander Professional

Who is online

Users browsing this forum: No registered users and 1 guest