表1:
idtb1 --pk published delete
表2:
idtb2 --pk idtb1 --fk published delete
如何通过命令published
一起更新2个表上的2列delete
,Update
答案 0 :(得分:4)
您无法在单个语句中更新多个表
BEGIN TRANSACTION
update A
set A.published = @published
from table1 A
inner join table2 B on B.idtb1 = A.idtb1
update B
set B.published = @published
from table2 B
inner join table1 A on B.idtb1 = A.idtb1
COMMIT