Ispirer Website Ispirer Capabilities - MySQL Migration Free Trial

MySQL Data Types - TEXT

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

MySQL - TEXT
Syntax TEXT[(n)] [CHARACTER SET charset | BINARY ] [COLLATE collate]
Data Variable-length character data, single-byte and multibyte character sets
Parameters n is the maximum number of characters, optional. CHARACTER SET specifies the character set, COLLATE specifies a collation for the character set.

BINARY is equal to specifying the binary collation
Range 65535 bytes or n if n is specified
Trailing Spaces Not removed when the value is stored and retrieved. But trailing spaces are insignificant in comparisons, primary and unique keys
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 Actual entry length
Internals If n is specified, TEXT is converted to the smallest data type large enough to hold n characters. TEXT(<255) is converted to TINYTEXT, TEXT(<16M) is converted to MEDIUMTEXT and TEXT(>16M) is converted to LONGTEXT
Version Differences MySQL 4.1 and later - CHARACTER SET and COLLATE options are available
Standards MySQL Extension

MySQL TEXT - Equivalents in Other Databases

Database Data Type and Conversion
Oracle CLOB, 4G; NCLOB, 4G, Unicode - UTF-8 or UTF-16
SQL Server VARCHAR(n | max), 1 ⇐ n ⇐ 8000, 2G if max is specified
PostgreSQL VARCHAR(n), 1 ⇐ n ⇐ 1G
Sybase ASE TEXT, 2G
Informix VARCHAR(n,r), 1 ⇐ n ⇐ 255, LVARCHAR(n), 1 ⇐ n ⇐ 32739
HP Neoview VARCHAR(n), 1 ⇐ n ⇐ (32708 - size of other columns)

Related Data Types in MySQL

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

All Data Types


© 1999-2024, Ispirer Systems, LLC. All Rights Reserved.