Hi All,
Maybe I don't see something obvious here but I'm getting constraint error and don't see other way to solve it as to just drop constraints and then create them back later.
So, I have these tables, Highway,Route, Hwy_Rte junction table for many to many :
Hwy
------------
Hwy_ID (PK)
More Columns
Rte
------------
Route_No(PK)
More Columns
Hwy_Rte
------------
Hwy_ID (PK)
Route_No (PK)
I'm trying to update Rte_No in other tables that have Rte_No as FK, so I need to update Rte table first.
It's done in a loop, reading values from a template table but here's a sample of SQL statement:
[highlight]update RTE set Rte_No = 'WA69' where Rte_No = 'HWY69'[/highlight]
And I get an error:
[highlight]
UPDATE statement conflicted with COLUMN REFERENCE constraint 'FK_RTE__HWY_RTE'. The conflict occurred in database 'SWIRL', table 'HWY_RTE', column 'RTE_NO'.
The statement has been terminated.
[/highlight]
I think it happens because Rte_no is part of PK in Hwy_Rte table, so I ended up dropping constraint on Hwy_rte table and do update. Am I doing anything wrong here, any suggestion?
Thanks
~Steve