RE: Please help me.

Gary Smith <[email protected]> Wed, 18 Mar 2009 12:24:30 -0700
Newsgroups gmane.comp.db.mysql.general,gmane.comp.db.mysql.windows
Message-ID <5017258D295FBE41917880488689F7B80FA4F32E58@VCSSBS.visionarycs.local>
Velentin,=20

http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html

Note the section for the droping of foreign keys used the contraint name, n=
ot the key name.  Try this and see if it solves the first problem (of remov=
ing the constraint).  Then you should be able to drop the column after that=
.

________________________________________
From: Valentin Ionescu [[email protected]]
Sent: Wednesday, March 18, 2009 11:27 AM
To: [email protected]
Cc: [email protected]; [email protected]
Subject: Please help me.

Hi!
My name is Valentin and I am writing to you for the following problem:
I created a database containing the table:

CREATE TABLE `documents_ex` (
  `ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `Journal_ex_ID` int(10) unsigned DEFAULT NULL,
  `Documents_ID` int(10) unsigned DEFAULT NULL,
  `Data` datetime DEFAULT NULL,
  `Nr` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`ID`),
  UNIQUE KEY `Journal_ex_ID` (`Journal_ex_ID`,`Documents_ID`,`Data`,`Nr`),
  KEY `Documents_ID` (`Documents_ID`),
  CONSTRAINT `documents_ex_ibfk_1` FOREIGN KEY (`Journal_ex_ID`) REFERENCES=
 `journal_ex` (`ID`) ON DELETE CASCADE,
  CONSTRAINT `documents_ex_ibfk_2` FOREIGN KEY (`Documents_ID`) REFERENCES =
`documents` (`ID`) ON DELETE CASCADE
) ENGINE=3DInnoDB DEFAULT CHARSET=3Dlatin1

After some time I decided to drop 'Journal_ex_ID' column and all its enviro=
nment from this non empty table.
All I tried to do like:

alter table documents_ex drop column Journal_ex_ID
or
alter table documents_ex drop foreign key  Journal_ex_ID
or
alter table documents_ex drop  key  Journal_ex_ID

 I receive the same error 150 and I don't know what to do.

Please help me.
 Best regards.




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[email protected]=
m=

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[email protected]