Anda akan membutuhkan sesuatu seperti ini - berbasis set solusi yang memperhitungkan bahwa dalam UPDATE pernyataan, Anda mungkin memperbarui beberapa baris sekaligus, dan karena itu pemicu Anda juga harus menangani beberapa baris di Inserted dan Deleted tabel.
CREATE TRIGGER [dbo].[updateUserId]
ON [dbo].[User_TB]
FOR UPDATE
AS
-- update the "Break" table - find the rows based on the *old* User_Id
-- from the "Deleted" pseudo table, and set it to the *new* User_Id
-- from the "Inserted" pseudo table
SET User_Id = i.User_Id
FROM Inserted i
INNER JOIN Deleted d ON i.TID = d.TID
WHERE
Break_TB.User_Id = d.User_Id
-- update the "Log" table - find the rows based on the *old* User_Id
-- from the "Deleted" pseudo table, and set it to the *new* User_Id
-- from the "Inserted" pseudo table
UPDATE Break_TB
SET User_Id = i.User_Id
FROM Inserted i
INNER JOIN Deleted d ON i.TID = d.TID
WHERE
Break_TB.User_Id = d.User_Id
Kode ini mengasumsikan bahwa TID kolom di User_TB tabel adalah kunci utama yang tetap sama selama pembaruan (sehingga saya dapat menggabungkan nilai-nilai "lama" dari Deleted tabel semu dengan nilai "baru" setelah pembaruan, disimpan di Inserted tabel semu)