NVP

Translation specification for transforming the NVP function to an equivalent UDF in Snowflake

Description

Extracts the value of the key-value pair where the key matches the nth occurrence of the specified name to search. See NVP.

[TD_SYSFNLIB.] NVP (
in_string,
name_to_search
[, name_delimiters ]
[, value_delimiters ]
[, occurrence ]
)

Sample Source Patterns

NVP basic case

Teradata

SELECT
NVP('entree=-orange chicken&entree+.honey salmon', 'entree', '&', '=- +.', 1),
NVP('Hello=bye|name=Lucas|Hello=world!', 'Hello', '|', '=', 2),
NVP('Player=Mario$Game&Tenis%Player/Susana$Game=Chess', 'Player', '% $', '= & /', 2);

Snowflake

NVP with optional parameters ignored

Teradata

Snowflake

NVP with spaces in delimiters

Teradata

Snowflake

NVP with non-literal delimiters

Teradata

Snowflake

Known Issues

1. Delimiters with spaces (\ ) need to have the backslash scaped in Snowflake

In Teradata, delimiters including space specify them using "\ " (see NVP with spaces in delimiters), as shown in the examples, in Teradata it is not necessary to escape the backslash, however, it is necessary in Snowflake. Escaping the backslashes in the delimiter can be done automatically by SnowConvert but only if the delimiter values are literal strings, otherwise the user will be warned that the backlashes could not be escaped and that it may cause different results in Snowflake.

  1. MSCEWI1020: Custom UDF inserted.

  2. MSCEWI2080: Non-literal delimiters with spaces need their backslash scaped in snowflake.

Last updated

Was this helpful?