View Full Version : Error deleting record due to FK constraint
08-07-2005, 04:03 PM
I'm getting an error in deleting a record from Customers table (or other tables such as Categories) in Northwind database of SQL Server, due to foreign key constraint. How can I solve it? Thanks a lot!
It sounds like there is a row in another table that needs the row your trying to delete. You could try deleting the referencing row(s) first then delete the record from the customers table.
It would help to see the table structure to be sure though.
08-08-2005, 05:15 AM
It sounds like there is a row in another table that needs the row your trying to delete.
Right. What if I dont know in advance which tables have that row? How can I play around with this? :rolleyes:
Thanks a lot.
how can you not know what rows? its your database right?
08-08-2005, 07:15 AM
I'm just testing with the classic Northwind db in SQL Server. Seems I need to study the whole db and check the related tables for deletion. :rolleyes:
I wanted to know if there's an easier way. :D
Thanks a lot!
I am unfamiliar with this Northwind db and I have never use SQL Server (even though I have it on CD somewhere...).
I know that you can find the reationships with MySQL with this: SHOW TABLE STATUS FROM your_db_name [like 'tabe_name'];
I don't know what the SQL Server command is for the same thing. I noticed MySQL does things a little differently from my time using Oracle.
08-08-2005, 09:14 AM
Thanks a lot! I'll check it out. :)
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.