#1
  1. No Profile Picture
    Carolyn
    Guest
    Devshed Newbie (0 - 499 posts)
    I feel stupid for asking this since I know it should be straightforward. I'm developping a small site http://emma.btti.com/carolyn/spot. I'm using MySql to store the urls. I set the size of the column to 50 characters but as you can see, I'm now getting sites with the ends lobbed off. I need to alter the size of the columns. Like I said, I know this should be simple but I've been through every piece of documentation I can find and nothing seems to work. Please help.

    Carolyn
  2. #2
  3. No Profile Picture
    rod k
    Guest
    Devshed Newbie (0 - 499 posts)
    Carolyn,

    Look in the manual under ALTER table.

    This is an example and I'm doing it from memory so you should still look it up as my memory isn't as good as it used to be

    Lets say this is the original definition:

    create table urls (id integer unsigned not null primary key auto_increment,
    url varchar(50));

    you can alter the table by using this:

    alter table urls change url varchar(100);

    This would make your max size 100.

    HTH

    Rod
  4. #3
  5. No Profile Picture
    Carolyn
    Guest
    Devshed Newbie (0 - 499 posts)
    No luck. I tried it but I get a syntax error near varchar(100). What gives?
  6. #4
  7. No Profile Picture
    moderator
    Guest
    Devshed Newbie (0 - 499 posts)
    I think you'll need to repeat the column's name. ie:

    alter table urls change url url varchar(100);

    The reason you need to do that is that you could change the column's name with the same command if you wanted to.
  8. #5
  9. No Profile Picture
    Carolyn
    Guest
    Devshed Newbie (0 - 499 posts)
    Thank you very much. That's it!

Similar Threads

  1. Replies: 0
    Last Post: January 3rd, 2004, 09:33 AM
  2. altering column contents
    By StealthElephant in forum MySQL Help
    Replies: 9
    Last Post: October 22nd, 2003, 08:30 AM
  3. altering column definition of primary key
    By hade in forum MySQL Help
    Replies: 2
    Last Post: April 10th, 2003, 10:12 AM
  4. Debugging column logic
    By tlush in forum PHP Development
    Replies: 2
    Last Post: March 13th, 2003, 04:47 PM
  5. Questions about column types
    By kixx in forum MySQL Help
    Replies: 3
    Last Post: March 10th, 2003, 07:12 PM

IMN logo majestic logo threadwatch logo seochat tools logo