Beginner

322. CHR Function

Learn how to convert a numeric character code into its corresponding character.

📘 Lesson 322 of 728 ⏱ 8 min 🎯 Intermediate

The CHR function converts a numeric character code into the corresponding character. The function name and supported character encoding can vary by database.

Converting numeric codes into characters can be useful when generating formatted text or working with encoded data.

Convert an ASCII code into its corresponding character.

SQL
SELECT
    CHR(65) AS CharacterValue;

CHR can be useful in text generation, data transformation, reporting, and database-specific string processing.

  • CHR converts a numeric code into a character.
  • It is related to character encoding.
  • It can generate special characters.
  • Function names vary by database.
  • Encoding behavior depends on the database.
What does CHR do?

CHR converts a numeric character code into its corresponding character.

Is CHR available in every database?

No. Different databases may use functions such as CHR or CHAR for this purpose.

Have you finished this lesson?

Introduction to SQL – All Lessons