如何替换所有非数字值?
问题描述:
这是 TERADATA(不是 SQL Server,也不是 Oracle)
This is TERADATA (not SQL Server, not Oracle )
我有一列电话号码:
(312)9879878
(298)989-9878
430-394-2934
394s9048ds987
..........
我需要将此列清理成
3129879878
2989899878
4303942934
3949048987
..........
所以只有数字应该保留.所有其他字母、特殊字符、连字符...都应该删除.我该怎么做?
So that only numbers should stay. All other letters, special characters, hyphens ... should be removed. How can I do this?
答
您的站点正在运行 TD 的哪个版本?如果它是 14 或者你安装了 oTranslate UDF,你可以简单地做一个嵌套翻译的老技巧:
Which release of TD is running at your site? If it's 14 or you got the oTranslate UDF installed you can simply do an old trick nesting Translate:
oTranslate(phonenum, oTranslate(phonenum, '0123456789', ''), '')