How can I do a BEFORE UPDATED trigger with sql server?

后端 未结 9 582
眼角桃花
眼角桃花 2020-11-28 10:18

I\'m using Sqlserver express and I can\'t do before updated trigger. There\'s a other way to do that?

9条回答
  •  误落风尘
    2020-11-28 10:48

    It is true that there aren't "before triggers" in MSSQL. However, you could still track the changes that were made on the table, by using the "inserted" and "deleted" tables together. When an update causes the trigger to fire, the "inserted" table stores the new values and the "deleted" table stores the old values. Once having this info, you could relatively easy simulate the "before trigger" behaviour.

提交回复
热议问题