?
Solved

delete table issues

Posted on 2010-09-07
6
Medium Priority
?
420 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
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 340 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 160 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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

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…
Article by: Leon
Software Metering within our group of companies has always been an afterthought until auditing of software and licensing became a pain point. Orchestrator and SCCM metering gave us the answer and it was an exciting process.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

770 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