Search code examples
snowflake-cloud-data-platformsnowflake-connector

Remove characters before ( in snowflake


I wanted to remove any character before ( in snowflake. For example: If the data has "Hello(World)", I want only "(World)".


Solution

  • Using SUBSTR and CHARINDEX functions:

    CREATE TABLE tab AS SELECT 'Hello(World)' AS col;
    
    SELECT SUBSTR(col, CHARINDEX('(', col))
    FROM tab;
    -- (World)