SQL trigger on Truncate

后端 未结 3 1158
旧巷少年郎
旧巷少年郎 2021-02-07 12:42

How to Fire a trigger when you do TRUNCATE (instead deleted) in MSSQL

3条回答
  •  庸人自扰
    2021-02-07 13:46

    Are you letting users run TRUNCATE TABLE ad hoc / willy nilly? If not, instead of worrying about using a trigger, why not wrap the TRUNCATE command in a stored procedure that also deals with whatever the trigger would have done after the truncate finished? (But you'd have to do it in the opposite order, of course.)

提交回复
热议问题