I have trigger trig_1
on racun table. I have some columns in racun table and i created trigger to don’t allow to update column iznos, but when i try to update another column in the same table, trigger doesn’t allow to do that. I tryed to delete and create trig_1 but nothing happend. I created that trigger in SQL 17 but now i am using SQL 18.
ALTER trigger [dbo].[trig_1] on [dbo].[racun] AFTER UPDATE as begin if update(iznos) raiserror('Ne moze ovo', 16, 1) rollback end
Advertisement
Answer
You should use IF UPDATE
statement with UPDATE
command in your trigger though.
ALTER trigger [dbo].[trig_1] on [dbo].[racun] AFTER UPDATE as begin if update(iznos) begin UPDATE [dbo].[racun] ... raiserror('Ne moze ovo', 16, 1) rollback end end