» Quick Links
You can make money on these forums
We Share profits with you
Google
Google Adsense
Google Adwords
YPN
Yahoo
MSN Search
Web Directories
Web Hosting
Web Hosting Offers
Hosting News
Suggestions
Link Building
Domain Names
PHP Forums
MySQL Forums
» More Links
OSP News
Reseller Hosting
Shared Hosting
Dedicated Servers
Google Adsense
Search Engine Marketing
Link Development
Affiliate Marketing


» Advertising
Multiple DC PR Check

Free SEO Tools


Go Back   Webmaster Forums > Website Developement / Programming > MySQL Forums

MySQL Forums Share Your Ideas and Tips about MYSQL. Ask questions about MYSQL. Table Design and Much More...

Reply
 
Thread Tools Display Modes
  #1  
Old 01-23-2007, 04:53 AM
Bkira Bkira is offline
Junior Member
 
Join Date: Oct 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
Bkira is on a distinguished road
Default deleting 2 tables???

Hey guys,
I am facing this problem of deleting 2 tables i.e.

CREATE TABLE `t1` (
`s4` int(11) default NULL,
`s5` int(11) default NULL,
PRIMARY KEY (`s4`),
KEY `s5_ind` (`s5`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

CREATE TABLE `t2` (
`s2` int(11) NOT NULL default '0',
`s3` int(11) default NULL,
PRIMARY KEY (`s2`),
KEY `s3_ind` (`s3`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

ALTER TABLE `t1`
ADD CONSTRAINT `t1_ibfk_2` FOREIGN KEY (`s5`) REFERENCES `t2` (`s2`) ON DELETE CASCADE;

ALTER TABLE `t2`
ADD CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`s3`) REFERENCES `t1` (`s4`) ON DELETE CASCADE;

Deleting one of tables the error is a foreign key constraint fails. Dropping one of rows with link, get the error (errno: 150) as well. How to delete this tables without drop all database?
Thanks in advance. -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
Revenue Sharing Ads ( ?):
  #2  
Old 01-23-2007, 09:21 AM
evy evy is offline
Senior Member
 
Join Date: Oct 2006
Posts: 111
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 17
evy is on a distinguished road
Default

Try to alter one of the tables to drop the constraint first, and then you can drop the tables. Or temporarily disable foreign key checks. -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
deleting big tables?? Aspen MySQL Forums 1 03-07-2007 09:17 AM
MERGE tables issue! Tyamini MySQL Forums 1 02-09-2007 07:36 AM
Lock Tables?? Bailee MySQL Forums 1 08-16-2006 06:54 AM
full text search in multiple tables phil MySQL Forums 1 08-08-2006 02:05 PM
Getting all rows from two tables cyberhost MySQL Forums 1 07-29-2006 03:17 PM


All times are GMT. The time now is 12:57 PM.