Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

changing fields in mysql

Options
  • 11-08-2005 10:09am
    #1
    Closed Accounts Posts: 658 ✭✭✭


    Hi

    I have a small problem. I have a table with various fields in it, and one of the fields is of type varchar(60). A design oversight on my part means that the data I enter into it is too big ( contact details ). I have already entered about 30 tuples into the table and it took me ages to do. Is there any way i can change this varchar(60) to a BLOB without actually affecting the data contained in it ?

    Thanks


Comments

  • Registered Users Posts: 83 ✭✭fatlog


    you could change it to text.

    are you using phpMyadMin or some similar tool to administer the database? if so then it can be done through this and if not then i recommend you use one as it makes life a lot easier.

    alternatively this SQL will change the column type to text for ya...

    ALTER TABLE `table1` CHANGE `column1` `column1` TEXT


  • Closed Accounts Posts: 35 Ivan Dunaev


    alternatively you can create a new column of desired type, copy data any way you like/need, drop the old column and rename the new column to match the old column's name - a bit safely if you afraid of automatic data conversion during ALTER TABLE


  • Closed Accounts Posts: 658 ✭✭✭pontovic


    thanks for the replys much appreciated. i should put more into planning my databases i think in the future


  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    pontovic wrote:
    thanks for the replys much appreciated. i should put more into planning my databases i think in the future
    Oh we've all done it. INT columns work perfectly until a Manager comes along and tells you he wants more precision.


Advertisement