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操作会更好。 –