0
我正在更新記錄。我需要創建一個會自動停用舊記錄的觸發器。記錄被更新到一個新表中不一樣。新插入記錄和原始記錄之間的值匹配由2列,假設col1和COL2更新後自動關閉舊記錄的觸發器
ALTER TRIGGER TR_On_Renewed_Customer
ON CustomerTable2
FOR INSERT
AS
// psudeo code
// Deactive the old record in customertable1
// if match is found between CustomerTable2 and
// CustomerTable1 based on col1 and col2, then update Active ='No'
我有點失去了如何使用該查詢存在。
我喜歡這個查詢,但我可以使用If Exist,它可以有點更優雅。謝謝你的答案,但我會用這個查詢。 –
我不確定你的意思是「更優雅」,但我認爲在這種情況下JOIN操作會更好。 –