Answer the question
In order to leave comments, you need to log in
How to update data in two tables related by foreign key?
There are two tables connected by foreign keys, and you need to change them at the same time. How can I do that?
DB - MS SQL.
Tried wrapping updates in commits - didn't work
Begin Tran
Update...
Update...
Commit Tran
[Работники]
int Id
[Заказы]
int Id
[Услуги]
int id
[Услуги в заказах]
int ЗаказId
int УслугаId
// Работники вынесены в отдельную таблицу потому, что разные работники могут делать разные услуги в одном заказе, а некоторые услуги могут быть без работников вообще
[Работники в услугах в заказах]
int ЗаказId
int УслугаId
int РаботникId
Answer the question
In order to leave comments, you need to log in
MS SQL does not support delayed integrity checking. You can temporarily disable checks during a transaction and then enable them again. But it is better to rework the data structure or, alternatively, use a DBMS in which this feature exists.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question