Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Trouble updating MySQL table datatype.

  • 01-04-2010 10:47AM
    #1
    Registered Users, Registered Users 2 Posts: 2,238 ✭✭✭


    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, Registered Users 2 Posts: 3,184 ✭✭✭Kenno90


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


  • Registered Users, Registered Users 2 Posts: 2,238 ✭✭✭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, Registered Users 2 Posts: 3,184 ✭✭✭Kenno90


    Anytime:D


Advertisement