Hi everybody
In my case I just want trigger to work after row inserted when status = 16 or row updated to status 16 but the problem is when any modification is made in any column the trigger will be running but that is wrong in my case.
here is my trigger:
can anyone correct trigger to achieve my case?Code:ALTER TRIGGER [dbo].[TRIG_CopyRegularEmp] ON [dbo].[Table1] AFTER INSERT,UPDATE AS BEGIN Declare @ID int select @ID = ID from inserted INSERT INTO Table2 (Table2.ID, Table2.Name, Table2.Status, Table2.Job) SELECT Table1.ID, Table1.Name, Table1.Status,Table1.Job FROM Table1 WHERE (Table1.Status = 16) AND (Table1.ID = @ID) END
bintaleb




Reply With Quote