MySQL Forums
Forum List  »  InnoDB

Soln. for MySql 1005 (Can't create table)
Posted by: Suresh Balu
Date: March 27, 2009 02:44AM

Add the followings in front and rear of the script

At front

SET FOREIGN_KEY_CHECKS = 0;


At Rear
SET FOREIGN_KEY_CHECKS = 1;

Sample query:

SET FOREIGN_KEY_CHECKS = 0;
DROP TABLE IF EXISTS `mailings`;
CREATE TABLE `mailings` (
mailingid INTEGER NOT NULL,
brandid INTEGER NOT NULL,
campaignid INTEGER UNSIGNED NOT NULL,
mailingcategoryid INTEGER UNSIGNED NOT NULL,
mailingname VARCHAR(255) NOT NULL,
mailingdesc VARCHAR(500) NULL,
issplited VARCHAR(3) NOT NULL DEFAULT 'no',
limitbyconfirmation VARCHAR(25) NOT NULL,
maxrecipients INTEGER UNSIGNED NULL,
isforwardtofriend VARCHAR(3) NULL,
forwardtofriendurl TEXT NULL,
mailingcontenttype VARCHAR(10) NOT NULL,
templateid INTEGER UNSIGNED NULL,
totalrecipients INTEGER UNSIGNED NULL,
isactive VARCHAR(3) NOT NULL DEFAULT 'yes',
createdon DATE NOT NULL,
createdby INTEGER NOT NULL,
updatedon DATE NULL,
updatedby INTEGER NULL,
deletedon DATE NULL,
deletedby INTEGER NULL,
PRIMARY KEY (`mailingid`),
KEY `mailingcategoryid` (`mailingcategoryid`),
KEY `campaignid` (`campaignid`),
KEY `brandid` (`brandid`),
CONSTRAINT `mailings_ibfk_1` FOREIGN KEY (`mailingcategoryid`) REFERENCES `mailingcategory` (`mailingcategoryid`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `mailings_ibfk_2` FOREIGN KEY (`campaignid`) REFERENCES `campaign` (`campaignid`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `mailings_ibfk_3` FOREIGN KEY (`brandid`) REFERENCES `brandmaster` (`brandid`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

SET FOREIGN_KEY_CHECKS = 1;

Options: ReplyQuote


Subject
Views
Written By
Posted
Soln. for MySql 1005 (Can't create table)
3445
March 27, 2009 02:44AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.