SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Evangelist
    Join Date
    Jan 2005
    Location
    bahrain
    Posts
    553
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up altering table's attribute data type

    hi
    i need query to alter the table's attribute data type
    e.g table 'user' has attribute 'name' of data type varchar (20)

    now i want to change it to data type 'text'
    its urgent plzzz.....
    regards
    phphelp

  2. #2
    Tranceoholic lilleman's Avatar
    Join Date
    Feb 2004
    Location
    Írebro, Sweden
    Posts
    2,716
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    You can do that by using an ALTER TABLE query:

    Code:
    ALTER TABLE user
      CHANGE COLUMN name
      name TEXT NOT NULL
    ERIK RIKLUND :: Yes, I've been gone quite a while.

  3. #3
    SitePoint Evangelist
    Join Date
    Jan 2005
    Location
    bahrain
    Posts
    553
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanx lilleman
    its urgent plzzz.....
    regards
    phphelp

  4. #4
    Chessplayer kleineme's Avatar
    Join Date
    Apr 2004
    Location
    Germany
    Posts
    608
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    see http://dev.mysql.com/doc/mysql/en/alter-table.html

    e.g.

    Code:
    ALTER TABLE user MODIFY name TEXT;
    Never ascribe to malice,
    that which can be explained by incompetence.
    Your code should not look unmaintainable, just be that way.

  5. #5
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,275
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    kleineme, how do you know it's mysql?

    phphelp, i cannot take anyone seriously who has a sig that says "its urgent plzzz....." for eveything that they post

    do you honestly expect to have user names greater than 255 characters????
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  6. #6
    Chessplayer kleineme's Avatar
    Join Date
    Apr 2004
    Location
    Germany
    Posts
    608
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Quote Originally Posted by r937
    kleineme, how do you know it's mysql?
    I haven't been here for two weeks, so it was some kind of reflex when I saw the keywords "data type 'text'"

    Quote Originally Posted by r937
    phphelp, i cannot take anyone seriously who has a sig that says "its urgent plzzz....." for eveything that they post
    and I may add that crossposting is an annoying habit as well:
    http://www.sitepoint.com/forums/showthread.php?t=248281

    although this time that habit proved me right to assume that the question was about MySQL
    Never ascribe to malice,
    that which can be explained by incompetence.
    Your code should not look unmaintainable, just be that way.

  7. #7
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Threads merged. Do not cross-post

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature


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
  •