I am creating a project that will hold long text.Probably paragraphs...Now what data type should I use for my datatable fields? I am using mySQL workbench...thanks
-
http://dev.mysql.com/doc/refman/5.0/en/char.html – Jonathan de M. Feb 05 '13 at 08:04
-
refer [this](http://stackoverflow.com/questions/12552035/saving-paragraph-of-text-to-mysql) – Bhavik Shah Feb 05 '13 at 08:05
-
possible duplicate of [MySQL TEXT vs BLOB vs CLOB](http://stackoverflow.com/questions/7071662/mysql-text-vs-blob-vs-clob) – PatrikAkerstrand Feb 05 '13 at 08:06
-
I tried to use the longtext then I manually added my question above...error like "data too long" has been encountered. Why? – PeterJohn Feb 05 '13 at 08:10
5 Answers
I believe TEXT
should be appropriate here, unless you are storing binary data. For binary data use BLOB
.

- 69,226
- 18
- 123
- 176
-
I tried to use the longtext then I manually added my question above...error like "data too long" has been encountered. Why? – PeterJohn Feb 05 '13 at 08:13
From the documentation: all possible string types.
For long texts, TEXT
is most suitable.

- 3,285
- 13
- 27
-
1I tried to use the longtext then I manually added my question above...error like "data too long" has been encountered. Why? – PeterJohn Feb 05 '13 at 08:14
MySQL VARCHAR size limit is 65535 bytes, and depending on encoding of the column, one char requires 1-4 bytes. If that is not long enough, you can use TEXT type.
"The maximum size of a BLOB or TEXT object is determined by its type, but the largest value you actually can transmit between the client and server is determined by the amount of available memory and the size of the communications buffers."

- 406
- 3
- 6
VARCHAR(0 to 65635 bytes), TEXT( 0 to 65535 bytes), BLOB (0 to 65535 bytes), MEDIUNTEXT(maximum length of 16,777,215 characters), MEDIUMBLOB(maximum length of 16,777,215 characters), LONGTEXT(maximum length of 4,294,967,295 characters), LONGBLOB (maximum length of 4,294,967,295 characters)

- 797
- 7
- 17