Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 11 Oct 2006 @ 16:50:21 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


Subj:   Re: SQL Replace Function for text
 
From:   Naomi Hildebrand

Rao,

I don't think there's an existing function that does that, but you could create your own, using the built-in functions.

You want a function that concatenates 3 substrings:

- the first is the initial part of your input string, up to right before the "part to be replaced" starts

- the second is the "replacing substring"

- the third is the last part of your input string, starting right after the "part to be replaced" ends


So you want something like (and I haven't tested this, or thought about what if the "part to be replaced" doesn't occur in your input string!):

     substr('InputString', 1, Index ('InputString', 'Input') -1) ||
     'Output' || substr('InputString', Index ('InputString', 'Input') +
     character_length('Input'))

Hope that helps.

Naomi



     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023