if this matters, i also set it unique
The max I've managed to set for varchar is 745 (it's set to unique also).
varchar [ ( n | max ) ] Use n to define the string size in bytes and can be a value from 1 through 8,000, or use max to indicate a column constraint size up to a maximum storage of 2^31-1 bytes (2 GB).
VARCHAR(255) stores 255 characters, which may be more than 255 bytes.
VARCHAR is a variable-length character data type. The default length is 80, and the maximum length is 65000 octets. For string values longer than 65000, use Long Data Types. Values can include trailing spaces.
Always specify a length to any text-based datatype such as NVARCHAR or VARCHAR . Don't over-use the MAX specification either as the resulting column then can't be indexed and comes with performance baggage.
Depends what version of MySQL you are running, before 5.0.3 there was a 255 character limit for varchar:
Values in VARCHAR columns are variable-length strings. The length can be specified as a value from 0 to 255 before MySQL 5.0.3, and 0 to 65,535 in 5.0.3 and later versions.
From: http://dev.mysql.com/doc/refman/5.0/en/char.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With