sqlsnowflake-cloud-data-platform

Varchar to Number in Snowflake


I am trying to convert data type for a column from Varchar to Number but I was not successful.

tried below functions: try_to_number cast (col as number(38,0))

enter image description here


Solution

  • maybe because of commas, try this :

    select try_to_number(replace(sentcount,','))