Home Page for the TeradataForum
 
https:

Archives of the TeradataForum

Message Posted: Mon, 02 Jul 2007 @ 13:01:54 GMT


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


Subj:   Re: The last occurance of a character
 
From:   Cornaire, Thierry

Hi,

You can try this :

     select substring(field from char(field) for 1) ||
     substring(field from char(field)-1 for 1) ||
     substring(field from char(field)-2 for 1) ||
     substring(field from char(field)-3 for 1) ||
     substring(field from char(field)-4 for 1) AS REVERSE_STRING
     ,SUBSTRING(field FROM CHARACTERS(field) - POSITION('_' IN
     REVERSE_STRING)+2)

Adapt the substring reverse sequence with max characters following the last '_'.

You can also use the UDF.

I hope help you


Regards



     
  <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: 28 Jun 2020