1

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.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Rosenberg
  • 2,424
  • 5
  • 33
  • 56

3 Answers3

2

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).

RacerX
  • 2,566
  • 3
  • 23
  • 21
1

You should be able to set the constraint as ON UPDATE CASCADE.

Andrew Lazarus
  • 18,205
  • 3
  • 35
  • 53
0

Hello

Good question but ????

one Method is Update trigger

you update in same time on different table

Community
  • 1
  • 1