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

Trouble updating MySQL table datatype.

Options
  • 01-04-2010 10:47am
    #1
    Registered Users Posts: 2,234 ✭✭✭


    Hi,

    I'm trying to change the datatype of a field in a MySQL table but I keep getting the following error. I'm trying to change from date to datetime.

    I thought it was something to do with data referencing that table soI have removed all data. Still no joy. Any ideas on what could be causing this?

    Cheers.
    SQL query:
    
    ALTER TABLE `lesson_booking_available` CHANGE `date` `date` DATETIME NOT NULL
    
    MySQL said: Documentation
    #1025 - Error on rename of '.\stable\#sql-fc_4c' to '.\stable\lesson_booking_available' (errno: 150) 
    


Comments

  • Registered Users Posts: 3,184 ✭✭✭Kenno90


    Try something like this
    ALTER TABLE lesson_booking_available MODIFY date DATETIME not null;
    


  • Registered Users Posts: 2,234 ✭✭✭techguy


    Cool, looks like it would work.

    I actually deleted all the FK constraints then modified the table. There were only 2 so it wasn't that bad..

    Thanks!


  • Registered Users Posts: 3,184 ✭✭✭Kenno90


    Anytime:D


Advertisement