Hello I am very new to triggers and would like some help with an update trigger. the trigger works fine as is but I need to Modify it to set attendance code to '01' where certain conditions are met. so I need set attendance code where @activity in ('641','651','661','671','
681) and @staff <>'3699' = '01
then I need a condition for @activity <>341 = '01' so basically the conditions set all activities to an attendance code of '01' when these conditions are met. I'm stumped and the if then else part.
Any help will be appreciated
create trigger [ar].[t_98TO01]
declare @signstatus char (1)
declare @awuid char (18)
declare @activity char (5)
declare @staff char (11)
select @signstatus = inserted.signstatus_c from inserted
select @awuid = inserted.uniqueid_c from inserted
select @activity = inserted.activity_c from inserted
select @staff = inserted.staffcode_c from inserted
--This sets attendance code to 01 when the record is signed
if @signstatus = 'S'
set attendance_c = '01'
where ar.activwork.uniqueid_c = @awuid
and ar.activwork.attendance_c in('98','99')