Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Error while deleting a record

Author  Topic 

gps
Starting Member

1 Post

Posted - 2005-11-09 : 01:30:50
Hi

I am getting the following error while trying to delete a record from a table:

Server: Msg 547, Level 16, State 1, Line 1
DELETE statement conflicted with COLUMN REFERENCE constraint 'comp_schema_fk01'. The conflict occurred in database 'Stdcfg411', table 'bms_Component_Schema', column 'bms_ComponentID'.
The statement has been terminated.

Can anyone explain what exactly can be the reason for this error?
The table bms_Component_Schema has 1 to many relationship with bms_components. Can this be a reason for that?

Thanks.

Cheers.

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2005-11-09 : 01:45:44
well .. you have set the parent child relationship between the 2 tables..

and you are trying to delete the records from the Parent table.. which has the their correspoding data in the child table..

so its give you can an constraint error..

To maitain the data Consistancy you should delete the records from the child table first and then from the parent table

or

if you are using SQL 2000 then you can try out ..

On Delete Cascade command.. which will delete the records from the child table as u delete from the parent table..

Hope this helps..

Complicated things can be done by simple thinking
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-11-09 : 02:27:46
You need to delete record from child table and then parent table

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -