I have to implement a trigger on a table such that some columns get automatically updated each time a row is updated. I am using the following trigger syntax:
create trigger degreedSkillPlan_updated on degreedSkillPlan
after update
as
if (select trigger_nestlevel() )> 1 return;
declare @id varchar;
update degreedSkillPlan set updatedDate = getdate(), lastModifiedDate = getDate() FROM inserted
WHERE inserted.skillPlanId = skillPlanId; ;
but this is not working. I haven't really implemented any trigger before. I have read some tutorials online but I am unable to figure out what is wrong with this. Also, will this work for multiple rows as stated in the accepted answer of >Handling multiple rows in SQL Server trigger