COLLATE
functionsupportedCore SQL functionsReturns a copy of the original string, but with the specified collation_specification property instead of the original collation_specification property. This copy can be used in subsequent string comparisons, which will use the new collation_specification.
Syntax
The COLLATE function can be called as a normal function
COLLATE(<string_expression>, '<collation_specification>')
The COLLATE function can be used as though it were an infix operator
<string_expression> COLLATE '<collation_specification>'
Parameters
| Name | Required | Description |
|---|---|---|
string_expression | required | The string to copy. |
collation_specification | required | The collation to store with the copy of the string. For more information about collation specifiers, see Collation specifications. |
Returns
Returns a copy of the original string, but with the specified collation_specification property instead of the original collation_specification.
Usage notes
- Each VARCHAR contains a property that holds the collation specifier to use when comparing that VARCHAR to another VARCHAR. The COLLATE function copies the string, but applies the new collation specification rather than the original specification to the copy. The string itself is unchanged; only the collation specifier associated with the string is changed.
- When COLLATE is used as an infix operator, the collation_specification must be a constant string, not a general expression.