Click here to Skip to main content
16,019,764 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,
I have an existing tables (up to 80 tables)... i have done partitions on 12 tables ,for those tables i delete the data and drop the constraints....now i added partitions for 12 tables very successfully.now i try to added constraints for those tables...i added primary keys very successfully.but i am unable to add foreign keys to those 12 partitioned tables....
gives an error code:1005:Can't create table 'Schema_name'.
Note: i tried to Synchronize from model(reverse engineer) to source...but still i have same problem.

Plz help me out of this problem...

Thanks in Advance.
Posted
Updated 20-Jun-11 19:06pm
v2
Comments
[no name] 21-Jun-11 0:17am    
Who knows?
[no name] 21-Jun-11 1:09am    
Can you post your code what you have tried for this?
deepika.tella 21-Jun-11 12:32pm    
I am using Alter command....Like
ALTER TABLE `scltms_test`.`locatorcheckout` DROP COLUMN `CheckoutStatusid` , ADD COLUMN `CheckoutStatusid` INT(11) NOT NULL AFTER `CheckOutDate` ,
ADD CONSTRAINT `fk_locatorcheckout_checkoutstatus1`
FOREIGN KEY (`CheckoutStatusid` )
REFERENCES `scltms_test`.`checkoutstatus` (`CheckoutStatusid` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_locatorcheckout_users1`
FOREIGN KEY (`LocatorId` )
REFERENCES `scltms_test`.`users` (`Usersid` )
ON DELETE NO ACTION
ON UPDATE NO ACTION
, DROP PRIMARY KEY
, ADD PRIMARY KEY (`locatorcheckoutid`, `LocatorId`, `CheckoutStatusid`)
, DROP PRIMARY KEY
, ADD PRIMARY KEY (`locatorcheckoutid`, `LocatorId`, `CheckoutStatusid`)
, DROP INDEX `indx_Locchkoutdt`
, ADD INDEX `indx_Locchkoutdt` USING BTREE (`CheckOutDate` ASC)
, DROP INDEX `fk_locatorcheckout_checkoutstatus1`
, ADD INDEX `fk_locatorcheckout_checkoutstatus1` (`CheckoutStatusid` ASC) ;

The Above code is the one of the tables... above script was generated from reverse Engineer(EER Diagram).

deepika.tella 21-Jun-11 12:34pm    
this table (locatorcheckout) has been partitioned

1 solution

Check this post for known causes

MySQL Error Number 1005 Can’t create table[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900