Log in

View Full Version : varchar max size



magik
01-26-2008, 05:02 AM
Hi,

I want to use the varchar command in my table but it limits 255 and I want to limit at least 750 characters, is there any alternative?

-magik602

Twey
01-26-2008, 05:03 AM
Try TEXT.

magik
01-26-2008, 05:26 AM
I can't set a limit, comes up with a syntax error saying
"You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(1000),"

Twey
01-26-2008, 06:44 AM
TEXT is a variable-length datatype, you don't specify a maximum at design time.

TEXT is can store up to 2 ^ 16 - 1 (65,355) bytes (or single-byte characters). That should be more than sufficient for your purposes. If you need more, consider upgrading to MEDIUMTEXT (2 ^ 24 - 1 or 16,777,216) or LONGTEXT (2 ^ 32 or 4,294,967,296). The overhead is progressively larger for each, though, and if you only need a thousand characters TEXT should be fine, even with multi-byte encoding.

magik
01-27-2008, 12:55 AM
You misread what I'm asking, I already knew about text but I need to have the 1000 limit or thereabouts. With text, i can't set a limit as it is already 65000 something.

Twey
01-27-2008, 05:05 AM
You'll need to set the limit in your script, I suspect.