Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 02 Jul 2007 @ 19:29:17 GMT


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


Subj:   Re: The last occurance of a character
 
From:   Michael Larkins

Anomy:

I wrote the following select based on the limited data you have provided. It assumes that the longest string you might encounter is 3 characters long (substring backs up 4 from the length of the string-can be adjusted if needed). It also assumes a VARCHAR (I called col), otherwise add a TRIM/TRAILING to the column used in the substrings.

     sel col,substring(substring(col from char(col)-4) from 1+position('_' in
     substring(col from char(col)-4)))
     from strings

You can use this substring in your CASE.


Hope this helps,

Michael Larkins
Certified Teradata Master
Certified Teradata SQL Instructor



     
  <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