![]() |
|
Archives of the TeradataForumMessage Posted: Wed, 24 Jun 2009 @ 14:29:45 GMT
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.
| ||||||||||||||||||||||||||||||||||||||||||||||||
| | ||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||
| Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||
| Last Modified: 15 Jun 2023 | ||||||||||||||||||||||||||||||||||||||||||||||||