Delete data with foreign key in SQL Server table
Posted
by
Andha
on Stack Overflow
See other posts from Stack Overflow
or by Andha
Published on 2011-11-24T01:10:40Z
Indexed on
2011/11/24
1:51 UTC
Read the original article
Hit count: 89
sql-server
I'm going to delete data in an SQL Server table (parent) which has a relationship with another table (child).
I tried the basic Delete query. But it isn't working (and I know it won't).
DELETE FROM table WHERE ...
It returned following error
The DELETE statement conflicted with the REFERENCE constraint ...
I need to keep the table's schema. I know that I just need to add some words in the query, I've ever done this before, but I just couldn't recall it.
© Stack Overflow or respective owner