ANSI Mode For Strings Comparison - COLLATE
This section defines the translation specification for a string in ANSI mode with the use of COLLATE.
Description
ANSI mode for string comparison and COLLATE usage
The ANSI mode string comparison will apply the COLLATE constraint to the columns or statements as required. The default case specification trim behavior may be taken into account.
Notice that in Teradata, the default case specification is 'CASESPECIFIC
', the same default as in Snowflake 'case-sensitive'
. Thus, these cases will not be translated with a COLLATE
because it will be redundant.
Sample Source Patterns
Setup data
Comparison operation
Case 1: Column constraint is NOT CASESPECIFIC and database mode is ANSI Mode
Teradata
Snowflake
Case 2: Column constraint is CASESPECIFIC and database mode is ANSI Mode
Teradata
Snowflake
Case 3: CAST NOT CASESPECIFIC column to CASESPECIFIC and database mode is ANSI Mode
Teradata
Snowflake
COLLATE 'en-cs' is required for functional equivalence.
Case 4: CAST CASESPECIFIC column to NOT CASESPECIFIC and database mode is ANSI Mode
Teradata
Snowflake
Case 5: CAST NOT CASESPECIFIC column to NOT CASESPECIFIC and database mode is ANSI Mode
Teradata
Snowflake
It requires COLLATE.
LIKE operation
Case 1: Column constraint is NOT CASESPECIFIC and database mode is ANSI Mode
Teradata
Snowflake
Case 2: Column constraint is CASESPECIFIC and database mode is ANSI Mode
Teradata
Snowflake
Case 3: CAST NOT CASESPECIFIC column to CASESPECIFIC and database mode is ANSI Mode
Teradata
Snowflake
Case 4: CAST CASESPECIFC column to NOT CASESPECIFIC and database mode is ANSI Mode
Teradata
Snowflake
IN Operation
Case 1: Column constraint is NOT CASESPECIFIC and database mode is ANSI Mode
Teradata
Snowflake
This case requires COLLATE(
column_name
, 'en-cs-rtrim')
Case 2: Column constraint is CASESPECIFIC and database mode is ANSI Mode
Teradata
For this case, the column does not have a column constraint, but the default constraint in Teradata ANSI mode is CASESPECIFIC
.
Snowflake
ORDER BY clause
Case 1: Column constraint is NOT CASESPECIFIC and database mode is ANSI Mode
Teradata
Snowflake
Please review FDM. Pending to add.
Case 2: Column constraint is CASESPECIFIC and database mode is ANSI Mode
Teradata
Snowflake
GROUP BY clause
Case 1: Column constraint is NOT CASESPECIFIC and database mode is ANSI Mode
Teradata
Snowflake
The case or order may differ in output.
RTRIM
is required in selected columns.
Case 2: Column constraint is CASESPECIFIC and database mode is ANSI Mode
Teradata
Snowflake
The order may differ.
HAVING clause
The HAVING clause will use the patterns in:
Evaluation operations.
For example:
=, !=, <, >.
LIKE operation.
IN Operation.
CAST to evaluation operation.
CAST to LIKE operation.
The following sample showcases a pattern with evaluation operation.
Sample: Column constraint is NOT CASESPECIFIC and database mode is ANSI Mode
Teradata
Snowflake
CASE WHEN statement
The CASE WHEN
statement will use the patterns described in:
Evaluation operations.
For example:
=, !=, <, >.
LIKE operation.
IN Operation.
CAST to evaluation operation.
CAST to LIKE operation.
The following sample showcases a pattern with evaluation operation.
Teradata
Snowflake
JOIN clause
Simple scenarios with evaluation operations are supported.
The JOIN
statement will use the patterns described in:
Evaluation operations.
For example:
=, !=, <, >.
LIKE operation.
IN Operation.
CAST to evaluation operation.
CAST to LIKE operation.
The following sample showcases a pattern with evaluation operation.
Sample: Column constraint is NOT CASESPECIFIC and database mode is ANSI Mode
Teradata
Snowflake
d.department_name
is NOT CASESPECIFIC
, so it requires COLLATE
.
Related EWIs
SSC-EWI-TD0007: GROUP BY IS NOT EQUIVALENT IN TERADATA MODE
SC-FDM-TD0032 : [NOT] CASESPECIFIC CLAUSE WAS REMOVED
Last updated