SQL Server's isNumeric() equivalent in amazon redshift

后端 未结 8 1895
庸人自扰
庸人自扰 2021-01-04 02:17
  • I\'m using amazon redshift as my data warehouse
  • I have a field (field1)of type string. Some of the strings start with four numbers and others with letters:
相关标签:
8条回答
  • 2021-01-04 02:58

    It looks like the code you are looking for the is the similar to function:

    where left(field,4) similar to '[0-9]{4}'
    

    Redshift doc

    0 讨论(0)
  • 2021-01-04 03:07

    We have tried the following and worked for most of our scenarios:

    columnn ~ '^[-]{0,1}[0-9]{1,}[.]{0,1}[0-9]{0,}$'

    This will positive, negative, integer and float numbers.

    0 讨论(0)
提交回复
热议问题