Search code examples
sqlsnowflake-cloud-data-platformnon-ascii-characters

Remove non-ASCII characters from a string in Snowflake


How do I remove all the non-ASCII characters from a string in Snowflake SQL? I have come across solutions using T-SQL etc but no article on how to do it in snowflake.


Solution

  • A regular expression should be enough, unless you have other cases in mind:

    select regexp_replace('Snéowñfla🔥ke', '[^\x00-\x7F]', '')