Archives of the TeradataForum
Message Posted: Wed, 24 Jun 2009 @ 14:29:45 GMT
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
|Copyright 2016 - All Rights Reserved|
|Last Modified: 27 Dec 2016|