Solved

delete table issues

Posted on 2010-09-07
6
418 Views
Last Modified: 2012-06-21
Hi,

I have created a few tables into a DB.
For some reason I need to remove all the tables I have created.
I have removed all the tables except one.

I am getting an error like this while trying the sql

delete from MappedRuleSet

Msg 547, Level 16, State 0, Line 1
The DELETE statement conflicted with the REFERENCE constraint "MappedRuleSet_TitleFilePartMapping_FK1". The conflict occurred in database "SS_TEST", table "dbo.TitleFilePartMapping", column 'MappingRuleSetID'.
The statement has been terminated.

Regards
la
0
Comment
Question by:la-tempestad
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 

Expert Comment

by:intelligenceon17
ID: 33616019
ya surely this will give error because u hve connected  many tables with each other .. since u hve used table columns from  more than one table in one table surely it will give error .. this has only one soltuion tht u shuld make remove constraint from it .. then del the table u want..
0
 
LVL 1

Author Comment

by:la-tempestad
ID: 33616125
So how do I remove the constraints using SQL or Enterprise manager.
I never did it before.


thanks
la
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 19

Expert Comment

by:Bhavesh Shah
ID: 33616157
Hi,

You no need to drop constraint.
if you already delete data from TitleFilePartMapping then you can u delete from MappedRuleSet.

check there is data in TitleFilePartMapping.
0
 
LVL 3

Accepted Solution

by:
dpicco earned 85 total points
ID: 33616159
Hi la-tempestad,

The TitleFilePartMapping table has a column MappingRuleSetID that is a foreign key back to the table you need to delete. You will have to either:
1. Remove the data in TitleFilePartMapping that is related to data in the MappedRuleSet table using a statement such as this

delete from dbo.TitleFilePartMapping where mappedrulesetid = (select id from MappedRuleSet)

OR

2. Remove the foreign key before deleting the MappedRuleSet table using a statement such as this:

ALTER TABLE dbo.TitleFilePartMapping
DROP CONSTRAINT MappedRuleSet_TitleFilePartMapping_FK1

Hope this helps you. Please let us know if we can assist further.
dpicco
0
 
LVL 19

Assisted Solution

by:Bhavesh Shah
Bhavesh Shah earned 40 total points
ID: 33616178

Table "TitleFilePartMapping" is child Table and MappedRuleSet is Master Table.

So its advised that you should not delete data from MappedRuleSet, if u dont want to delete data from "TitleFilePartMapping"

Still if u want to drop constraint then
Open Management Studio
Select DataBase
Select Table -TitleFilePartMapping
expand the table by clicking on +

Select Key and then select MappedRuleSet_TitleFilePartMapping_FK1

RIGHT CLICK AND REMOVE
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question