0

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

Lukasz Szozda
  • 162,964
  • 23
  • 234
  • 275

1 Answers1

0

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

dbaOnTap
  • 186
  • 1
  • 6