0

I try all of this options: Table Data Type Alter

And this is the output:

mysql> ALTER TABLE Xarxa CHANGE codiXarxa codiXarxa INT;
ERROR 1025 (HY000): Error on rename of './monxar/#sql-969_5b' to './monxar/Xarxa' (errno: 150)

mysql> ALTER TABLE Xarxa CHANGE codiXarxa codiXarxa INT(3);
ERROR 1025 (HY000): Error on rename of './monxar/#sql-969_5b' to './monxar/Xarxa' (errno: 150)

mysql> ALTER TABLE Xarxa MODIFY COLUMN codiXarxa codiXarxa INT(3);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'codiXarxa INT(3)' at line 1

mysql> alter table Xarxa modify codiXarxa int(3);
ERROR 1025 (HY000): Error on rename of './monxar/#sql-969_5b' to './monxar/Xarxa' (errno: 150)
Community
  • 1
  • 1
  • possible duplicate of [MySQL: Can't create table (errno: 150)](http://stackoverflow.com/questions/4061293/mysql-cant-create-table-errno-150) – Marcus Adams Mar 10 '15 at 12:37
  • There is probably a foreign key constraint between this table and another one, and by modifying it you are creating a data type mismatch between them. Look at `SHOW CREATE TABLE Xarxa` to see existing key relationships. – Michael Berkowski Mar 10 '15 at 12:48

1 Answers1

1
ALTER TABLE Xarxa MODIFY codiXarxa INTEGER;

But it looks like errors you get are foreign key errors. If I'm right... drop foreign key first and than modify data type.

ALTER TABLE Xarxa DROP FOREIGN KEY codiXarxa;
ALTER TABLE Xarxa MODIFY codiXarxa INTEGER;
MatejG
  • 1,393
  • 1
  • 17
  • 26