0

Is it possible to replace text in a SqlBase? I found there is a @REPLACE function but I see it just replaces using positions in the string:

The following expression returns the value 'RALPH':

@REPLACE('RALF', 3, 1, 'PH')

What I need is to replace a substring by another, In Sql Server it's like this:

This returns 'ABA':

SELECT REPLACE('ABC', 'C', 'A')

Thanks!

JCIsola
  • 110
  • 1
  • 11

1 Answers1

1

Using the literals in your 'ABC' to 'ABA' example....

Select @REPLACE( 'ABC', @FIND( 'C', 'ABC', 0 ), @LENGTH('C'),  'A' )

Using the literals in your 'RALF' to 'RALPH' example....

Select @REPLACE( 'RALF', @FIND( 'F', 'RALF', 0 ), @LENGTH('F'),  'PH' )
Steve Leighton
  • 790
  • 5
  • 15