Страница 1 из 1

тип данных VARCHAR

Добавлено: 2009-04-15 14:52:57
Gloft
если не ограничивать тип VARCHAR (не указываит при создании поля) , то сколько символов можно хранить в поле?

Re: тип данных VARCHAR

Добавлено: 2009-04-15 15:19:28
zg
255, всё что свыше TEXT

UPD: ограницение походу только для четвёртой муси, на пятой можно и больше указывать.... ща доку посмотрю

Re: тип данных VARCHAR

Добавлено: 2009-04-15 15:27:35
zg
http://dev.mysql.com/doc/refman/5.1/en/char.html
The length of a CHAR column is fixed to the length that you declare when you create the table. The length can be any value from 0 to 255. When CHAR values are stored, they are right-padded with spaces to the specified length. When CHAR values are retrieved, trailing spaces are removed unless the PAD_CHAR_TO_FULL_LENGTH SQL mode is enabled.

Values in VARCHAR columns are variable-length strings. The length can be specified as a value from 0 to 65,535. The effective maximum length of a VARCHAR is subject to the maximum row size (65,535 bytes, which is shared among all columns) and the character set used.


http://dev.mysql.com/doc/refman/4.1/en/char.html

Код: Выделить всё

Values in VARCHAR columns are variable-length strings. The length can be specified as a value from 1 to 255 before MySQL 4.0.2 and 0 to 255 as of MySQL 4.0.2.
В четвёрке и ниже - 255, в пятёрке 65535.

Но тут есть пара ньюансов, я бы не советовал использовать varchar большой длины.