[Solved] Is it possible to specify length of "text"

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

[Solved] Is it possible to specify length of "text"

Post by Benjamin »

This is something I have always wondered. I am guessing you don't have to specify a length because the length is variable, but how do I specify a maximum length for the text data type?
Last edited by Benjamin on Fri Feb 24, 2006 2:01 pm, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

The maximum length is defined by the specific type you use.
TINYTEXT / TINYBLOB :arrow: 255 bytes.
TEXT / BLOB :arrow: 65535 bytes (64K)
MEDIUMTEXT / MEDIUMBLOB :arrow: 16,777,215 bytes (16MB)
LONGTEXT / LONGBLOB :arrow: 4,294,967,295 bytes (4GB)

http://dev.mysql.com/doc/refman/4.1/en/ ... rview.html
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

Ok, so then I can only limit it via code then.
Post Reply