从Teradata中的列过滤不需要的字符
我的表中有一个电话号码列,值仅是数字,没有特殊字符。对于其中一列,我获得了一个值为“:1212121212”。
我将需要过滤此记录,并在Teradata中带有任何特殊字符的任何记录。谁能为此提供帮助。
我尝试了以下解决方案,但它不起作用
where (REGEXP_SUBSTR(column_name, '[0-9]+')<>1 or column_name is null )
I have a Phone number column in my table with values only being numbers and no special characters. for one of the column I got a value coming in as ":1212121212".
I will need to filter this record and any records coming in with any special characters in teradata. Can anyone help on this.
I have tried the below solutions but it is not working
where (REGEXP_SUBSTR(column_name, '[0-9]+')<>1 or column_name is null )
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在MS SQL Server db中,您可以使用
trycast
找到具有非数字字符的条目:在Teradata db中,您可以使用
to_number
:如果要保持靠近您的尝试,可以使用
喜欢
找到未数字条目:请注意,当您的表有很多行时,这可能会变得慢。
In MS SQL Server DB's, you can use
TRYCAST
to find those entries having non numeric characters:In Teradata DB's, you can use
TO_NUMBER
:If you want to stay close to your attempt, can use
LIKE
to find not numeric entries:Note this could get slow when your table has very many rows.
谢谢乔纳斯。由于我只需要数字值,而长度应为10,因此我尝试了以下操作,并且它起作用。这将忽略所有其他特殊字符。
Thanks Jonas. Since I need only numeric values and the length should be 10, I tried the below and it worked. This would ignore all the additional special characters.