开发者

How to update same columns on different tables at the same time?

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 n开发者_JS百科eed to, I just don't know how to update it simultaneously.

Thanks.


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


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


Hello

Good question but ????

one Method is Update trigger

you update in same time on different table

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜