I have an update trigger which runs if field 'urejeno' gets modified.
USE [MYDATABASE]
GO
create trigger trg_MyTrigger on dbo.mytable
after update
as
if @@ROWCOUNT = 0
return
set nocount on
if UPDATE (UREJENO)
update mytable
set UREJENO_KDAJ = getdate(),
UREDIL_KDO = USER_NAME()
from mytable S
inner join Inserted I on S.TW_ID = I.TW_ID
However I would like to add a condition so that if 'urejeno' = True the trigger does what is described above but if the condition is 'False' I want to set the mentioned fields to NULL.
What must I change ?