Skip to content

CHAR

The CHAR data type is conceptually a fixed-length character string that is padded with trailing blanks.

Note: Trailing blanks are removed from strings in CHAR columns when the data is stored. Blanks are restored on output to the client. A CHAR(5) column, for example, returns 5 bytes to the client but may store fewer than 5 bytes in the database. All CHAR-related functions and operators work on a compact representation of the column data.

For more details and examples, see Trailing Blanks in Character Data.

An attempt to load a string that is longer than the specified length of a CHAR column results in a value too long error.

A CHAR column without a length specification defaults to a 1-byte column.

The maximum length of a CHAR column is 64000 bytes. The maximum length of a row in a table is 65536 bytes (216).

Parent topic:SQL Data Types