Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 24 Jun 2009 @ 14:29:45 GMT


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


Subj:   Address Parsing
 
From:   Arun.Ballari

Hi,

By any chance, would you know if there is a way to remove alpha characters from a field.

Example: If I have an address of "123 Main Street". How can I return 123?

One way is to use index and substring function. Is there any other way?

     select addr_line1,
            trim(case when index(addr_line1, ' ') = 0
                      then addr_line1
                           else substr(addr_line1, 1, index(addr_line1, ' '))
                      end),
            trim(case when index(addr_line1, ' ') > 0
                      then substr(addr_line1, (index(addr_line1, ' ') +1), 50)
                      end)
            from db.tbl

Thx,

Arun.



     
  <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: 27 Dec 2016