netezza nzload与isnumeric类似的功能吗? [英] netezza nzload similar function to isnumeric?
问题描述
我有一个平面文件中的数据,该文件是通过nzload
加载到netezza中的.
I have data from a flat file that I am loading into netezza via nzload
.
某些字段类型是数字,但是,接收到的数据有时可能包含无效字符.
Some of the field types are numeric however, the data received can sometimes contain invalid characters.
如何检查以确保导入中的数据isnumeric
?
How can i check to make sure that the data isnumeric
in my import?
我在T-Sql中看到了try_cast
,但是在netezza中却没有看到任何类似的东西.
I saw try_cast
for T-Sql but didn't see anything similar in netezza.
推荐答案
Netezza不等同于try-cast
,但是您可以通过几种不同的方法测试该值是否为数字.如果安装了SQL Extensions Toolkit
,则可以使用正则表达式功能.
Netezza doesn't have an equivalent to try-cast
, you can however test if the value is numeric a few different ways. If you have the SQL Extensions Toolkit
installed you can use a regex function.
sql_functions.admin.regexp_like(<Column Name>, '^[+-]?[0-9]*[.]?[0-9]*$')
否则,您可以使用translate
功能.
Otherwise you can use the translate
function.
translate(<Column Name>,'0123456789','') in ('','.','-','-.')
这篇关于netezza nzload与isnumeric类似的功能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!