25 Mar 19 · npack · #sql ·   Bookmark   ×

TRANSLATE syntax and usage in Snowflake Datawarehouse

To achieve one-to-one translation of each character use TRANSLATE.

Syntax:

TRANSLATE( <subject>, <sourceAlphabet>, <targetAlphabet> )

Example:

To Translate all occurrences of ‘X’ to ‘c’, ‘Y’ to ‘e’, ‘Z’ to ‘f’ and remove ‘❄’ characters:

select translate('❄a❄bX❄dYZ❄','XYZ❄','cef');

Result:

--------------------------------------+
TRANSLATE('❄A❄BX❄DYZ❄','XYZ❄','CEF') |
--------------------------------------+
abcdef |
--------------------------------------+

npack

posted on 25 Mar 19

Enjoy great content like this and a lot more !

Signup for a free account to write a post / comment / upvote posts. Its simple and takes less than 5 seconds

Copied