Results 1 to 6 of 6

Thread: varchar max size

  1. #1
    Join Date
    Oct 2007
    Posts
    23
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default varchar max size

    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

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Try TEXT.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Oct 2007
    Posts
    23
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    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),"

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    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.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Oct 2007
    Posts
    23
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    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.

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    You'll need to set the limit in your script, I suspect.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •