MySQL Data Types - NCHAR

Versions: MySQL 5.x, 4.x and 3.23

MySQL - NCHAR
Syntax NCHAR[(n)]
Data Fixed-length character data in the predefined character set - UTF8
Parameters n is the maximum number of characters, optional
Range 0 ⇐ n ⇐ 255
Default n is 1
Padding Right-padded with spaces to n
Trailing Spaces Removed when the value is retrieved if PAD_CHAR_TO_FULL_LENGTH SQL mode is not specified. Trailing spaces are insignificant in comparisons, primary and unique keys
Empty String CHAR(0) is allowed that can store 2 values: '' (empty string) and NULL
Error Handling Exceeding data truncated and a warning is generated if strict SQL mode is not enabled, otherwise in case of non-space characters truncation, an error is raised
Storage Size n bytes
Notes NCHAR is equivalent to CHAR CHARACTER SET UTF8
Synonyms NATIONAL CHAR, NATIONAL CHARACTER
Standards ANSI SQL

MySQL NCHAR - Equivalents in Other Databases

Database Data Type and Conversion
Oracle NCHAR(n), 1 ⇐ n ⇐ 2000/charsize, Unicode - UTF-8 or UTF-16
SQL Server NCHAR(n), 1 ⇐ n ⇐ 4000, Unicode - UCS-2
IBM DB2 GRAPHIC(n), 1 ⇐ n ⇐ 127, double-byte
PostgreSQL CHAR(n), 1 ⇐ n ⇐ 1G
Sybase ASE NCHAR(n), 1 ⇐ n ⇐ pagesize (2K, 4K, 8K or 16K), Character set - database default
UNICHAR(n), 1 ⇐ n ⇐ pagesize, Unicode
Sybase ASA NCHAR(n), 1 ⇐ n ⇐ 8191, Unicode - UTF-8
Informix NCHAR(n), 1 ⇐ n ⇐ 32767, database character set
Teradata CHAR(n), 1 ⇐ n ⇐ 64000/charsize
HP Neoview NCHAR(n), 1 ⇐ n ⇐ (32708 - size of other columns), Unicode - UCS-2 or ISO88591 (Latin1)
Interbase/Firebird NCHAR(n), 1 ⇐ n ⇐ 32767, single-byte ISO8859_1 (Latin 1); CHAR(n), 1 ⇐ n ⇐ 32767, with CHARACTER SET UTF-8

Related Data Types in MySQL

Data Types
Fixed-length character data CHAR(n)
Variable-length character data VARCHAR(n) NVARCHAR(n) TINYTEXT TEXT MEDIUMTEXT
Character large objects LONGTEXT

All Data Types

Oracle SQL Server IBM DB2 MySQL PostgreSQL Sybase ASE Sybase ASA Informix DS Teradata HP Neoview Interbase/Firebird


SQLWays Product Page - Migration to MySQL Free Evaluation

Discussion

Enter your comment:
KIZAK
 
sqlways/mysql/data-types/nchar.txt · Last modified: April 25, 2012, 04:44:53 AM (external edit)
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki