Home > OS >  Snowflake Using Regular Expressions to Remove Values from a Column
Snowflake Using Regular Expressions to Remove Values from a Column

Time:09-23

I am trying to use regular expressions to remove some weirdly formatted dates from a column.

I found enter image description here

Then coalesce:

select coalesce(
        try_to_date($1,'YY-MON-DD') 
        , try_to_date($1,'YYYY-MM-DD') 
        , try_to_date($1,'YYYY-MM-DD HH:MI:SS') 
        , try_to_date($1,'YYYYMMDD') 
    ) fixed
    , $1 original
from values('20-APR-30'),('20-FEB-25'),('2021-12-01'),('2021-12-10 00:00:00'),('20211210')
;

enter image description here

  • Related