Hi,

I am using Northwind database and I am trying to delete the Products information from the Products table using SQL. However, when I tried to do that, it says that it can not be deleted because it is related to an another table. My problem is, when I deleted the table that was related to Products manually, it worked, but when I tried it code-wise, it is not working. How do I delete the relationship between the two tables because I just want to remove the information in the Products table? Can anyone help me on that?

Thanks in advance!

Recommended Answers

All 2 Replies

you cannot do it without delete related data.

To do this. Whenever you delete records in the table with referential integrity, you have first delete rows from the child tables and then delete the master row from the Product table, in your case.

Because of the foreign key constraint it will not allow you to delete the main record from the product table and it will leave the records related to the key field in other child tables, hence leaving orphan records.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.