SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    Patience... bronze trophy solidcodes's Avatar
    Join Date
    Jul 2006
    Location
    Philippines
    Posts
    911
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Cool #1170 - BLOB/TEXT column 'urlname' used in key specification without a key length ?

    I'm using PHPMyAdmin

    and I have this error,
    Code:
    #1170 - BLOB/TEXT column 'urlname' used in key specification without a key length
    This is the command I used,
    Code:
    ALTER TABLE  `finishedurls` ADD  `urlname` TEXT NOT NULL ,
    ADD INDEX (  `urlname` )
    Now How do I fix this?

    Thanks in advanced.

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,015
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by solidcodes View Post
    Now How do I fix this?
    specify a length

    see http://dev.mysql.com/doc/refman/5.0/...n-indexes.html

    by the way, are you sure you want TEXT? TEXT is for, you know, big chunks of text, e.g. 200 kilobytes

    an urlname sounds like it will easily fit into a modestly long VARCHAR, e.g. 200 bytes
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    Patience... bronze trophy solidcodes's Avatar
    Join Date
    Jul 2006
    Location
    Philippines
    Posts
    911
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Thanks rudy.
    But try this forum URL above for example it already reached 130 characters.
    So I guess TEXT is the safest way.
    Because VARCHAR is too short.

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,015
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by solidcodes View Post
    Because VARCHAR is too short.
    no, it's not

    before mysql version 5.0.3, VARCHAR had a maximum length of 255

    subsequently, VARCHAR has a maximum length of 65,535
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


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
  •