February 8, 2010 at 7:07 pm
query for order of the relationship
i had relationship with all the tables
how to delete the tables from child to master in sql server 2005
February 9, 2010 at 7:37 am
Delete the records in the tables you mean?
If you defined the relationship with cascading option, then you can delete the master table and the records in child tables will also be deleted. Or else you will have to delete the child records first and then the master records.
I am not sure if this was your question.
-Roy
February 9, 2010 at 8:01 am
As Roy indicates, you can delete your child records and then delete the parant records. If the relationships are cascading, you can drop the parents and the children will automatically be deleted.
Another way is to drop you foreign key constraints on your affected tables, delete the desired records, then verify that you have left no orphans before re-applying your foreign keys.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply