REPLACE

String Function

Description

Replaces all occurrences of a set of characters within an existing string with other specified characters. (Redshift SQL Language Reference REPLACE function).

This function is fully supported in Snowflake.

For more information about quoted identifiers in functions, click here.

Grammar Syntax

REPLACE(string, old_chars, new_chars)

Sample Source Patterns

Input Code:

IN -> Redshift_01.sql
SELECT REPLACE('Hello World', ' ', '_') AS modified_string,
       REPLACE('Apple, Orange, Banana, Grape', ',', '') AS fruits,
       REPLACE('http://example.com/path/to/resource', '/path/to', '/new-path') AS updated_url;

Output Code:

OUT -> Redshift_01.sql
SELECT REPLACE('Hello World', ' ', '_') AS modified_string,
       REPLACE('Apple, Orange, Banana, Grape', ',', '') AS fruits,
       REPLACE('http://example.com/path/to/resource', '/path/to', '/new-path') AS updated_url;

Known Issues

No issues were found.

There are no known issues.

Last updated