0
How to delete many columns from linked tables together
regarding constraints
4 Respostas
+ 1
Sorry, "linked" means "related by a constraint"?
+ 1
(1/2) Ok. Well, that depends on the relationship between the tables, and the sequence of the delete statements. Say you have a lookup table:
****************
* id1 * name 1 *
* id2 * name 2 *
****************
and a fact table
**************************
* date1 * id1 * amount 1 *
* date2 * id1 * amount 2 *
* date2 * id2 * amount 3 *
**************************
and the id column in the fact table has a n:1 relationship with the id in the lookup table (i.e. a foreign key).
If you try to delete first from the lookup table, you'll not be able to, because you'll be violating the constraint. If you delete from the fact table first, that'll be fine.
+ 1
(2/2) Still, if you need to remove first from the fact table, prior to that you'll need to deactivate the constraint. But at the risk that your db will be inconsistent.
0
yes@Alvaro