try_to_date not a valid function within Alteryx SQL

90 Views Asked by At

After testing coding with snowflake, I implemented it within Alteryx's SQL builder and it doesn't acknowledge try_to_date as a function

I am selecting a database column to convert to date - there are some however that are '00000000' which throws up an error if using 'to_date'

I was thinking a work around could be converting these '00000000' to NULL, would to_date function run then?

Code example which currently throws up date conversion error

select SNO_P."Finalised On", 

to_date(SNO_P."Finalised On", 'YYYYMMDD') as "Finalised_On"

from SNO_P

where "Calendar_Year" = '2022' 
    and DateDiff(day, "Finalised_On", GetDate()) <= 40

Thank you for any help

1

There are 1 best solutions below

0
dbaOnTap On

If you do convert '00000000' to NULLs then yes, SELECT to_date(NULL,'YYYYMMDD') will return NULL