Reputation: 2454
I have Table-A
with a column called serial_number
, and Table-B
has the same column.
Update a single table is not possible to their linkage, upon attempt though, this is the error:
The UPDATE statement conflicted with the FOREIGN KEY constraint "L_231". The conflict occurred in database "Main", table "dbo.Products". The statement has been terminated.
I know how I can delete the field in both in case I need to, I just don't know how to update it simultaneously.
Thanks.
Upvotes: 1
Views: 253
Reputation: 128
Hello
Good question but ????
one Method is Update trigger
you update in same time on different table
Upvotes: 0
Reputation: 2784
this is a BAD design. if this isn't a "one time thing" to fix an issue, but part of your applicaion, you need a redesign.
You shouldn't update keys, use a surrogate key (like an identity) instead and then store the serial_number
as a plain data column (which can be easily changed).
Upvotes: 2
Reputation: 19340
You should be able to set the constraint as ON UPDATE CASCADE
.
Upvotes: 1