Solved

delete table issues

Posted on 2010-09-07
6
417 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 7

Expert Comment

by:rashmi_vaghela
ID: 33616063
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
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 
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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

This very simple solution applies to a narrow cross-section of the "needs to close" variety. In this case, the full message in Event Viewer was in applog, Event ID 1000: Faulting application iexplore.exe, version 8.0.6001.18702, faulting module …
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…
Viewers will learn how to maximize accessibility options in an Excel workbook for users with accessibility issues.
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…

733 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