Home Page for the TeradataForum

Archives of the TeradataForum

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

  <Prev Next>  
Next> Last>>  

Subj:   Address Parsing
From:   Arun.Ballari


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, ' '))
            trim(case when index(addr_line1, ' ') > 0
                      then substr(addr_line1, (index(addr_line1, ' ') +1), 50)
            from db.tbl



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