CODEPOINT

All functions > STRING > CODEPOINT

Returns the Unicode code point of the first character in a string.

Syntax

CODEPOINT(expr)
sql

Arguments

ParameterTypeRequiredDescription
stringVARCHARYesA VARCHAR input containing the character to convert

Returns

The Unicode code point of the first character

Notes

  • Only the first character of the input string is considered
  • For multi-byte Unicode characters, returns the full Unicode code point
  • Returns NULL if the input is NULL
  • Returns 0 for empty strings
  • This is the inverse operation of CHR

Examples

Last update at: 2025/10/13 10:23:46