Dear Paul,
                Try UPDATE <TABLE> SET CustName = 
(SRPL(CustName,’ABC’,’XYZ’,0)) WHERE (SGET(CustName,3,1)) = ‘ABC’

                The code above assumes that ABC only appears once in each 
instance of CustName and that when it appears it is always the first three 
characters.  If either (or both) of these assumptions are false, then some 
modification of the code will be necessary.
                                                                                
Jason

Jason Kramer
University Archives and Records Management
002 Pearson Hall
(302) 831 - 3127 (voice)
(302) 831 - 6903 (fax)

From: [email protected] [mailto:[email protected]] On Behalf Of Paul Buckley
Sent: Tuesday, June 23, 2015 2:44 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - SQL Question

I’m using the latest eXtreme 9.5 (64) and I’ve got a question for the SQL 
gurus. Here’s some sample data:

A table has 2 columns, customerID and CustName
CustomerID        CustName

1                                             ABC 123

2                                             ABC 234

3                                             ABC 345

4                                             DEF 123

5                                             DEF 234

6                                             GHI 123

7                                             GHI 234

Is there a SQL Update command (or other command) that will change the ‘ABC’ 
portion of the column CustName to ‘XYZ’, the results would be:

CustomerID        CustName

1                                             XYZ 123

2                                             XYZ 234

3                                             XYZ 345

4                                             DEF 123

5                                             DEF 234

6                                             GHI 123

7                                             GHI 234

I know I can do it with a snippet of code and a declare cursor but just 
wandering if there is a slick SQL command.

TIA,
Paul Buckley


Reply via email to