2010-01-25 74 views
1

我正在使用MYSQL 5.1。當我嘗試刪除表中的列時,會引發以下錯誤。 MATERIAL_OUTWARD_ID是一個外鍵。MYSQL - 無法刪除列

查詢:

alter table `tispa`.`customer_invoice` drop `MATERIAL_OUTWARD_ID` 

錯誤:

Error on rename of '.\tispa\#sql-78_8' to '.\tispa\customer_invoice' (errno: 150) 

回答

1

我修好了。

首先刪除外鍵像

alter table `tispa`.`customer_invoice` drop foreign key `FK_material_out_id` ; 

然後刪除列類似

alter table `tispa`.`customer_invoice` drop `MATERIAL_OUTWARD_ID`; 

它將工作。

1

嘗試下探外鍵?

alter table 
... 
DROP FOREIGN KEY MATERIAL_OUTWARD_ID