tags:

views:

39

answers:

2

Hi,

I am using MYSQL 5.1. When i try to drop a column in a table, it throws the following error. MATERIAL_OUTWARD_ID is a foreign key.

Query:

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

Error:

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

try dropping the foreign key?

alter table 
...
DROP FOREIGN KEY MATERIAL_OUTWARD_ID
ghostdog74
+1  A: 

I have fixed it.

First drop the foreign key like

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

Then drop the column like

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

It will work.

Srinivasan