I have a simple update query that runs as a job each evening.The query adds information from the Employee Master table to the Employee Leavers Table:
UPDATE EMPLOYEE.dbo.LEAVERS
SET JOB = JOBTITLE
STARTDATE = CONVERT(Char,b.DATEOFJOIN,103)
FROM EMPLOYEE.dbo.LEAVERS a JOIN EMPLOYEE.dbo.MASTER b
ON a.STAFFNO = b.STAFFNO
WHERE LEAVEDATE IS NOT NULL
I would like to create an update trigger to do this as soon as the LEAVEDATE is entered but do not know now to write triggers. Can anyone help me with a code example?
UPDATE EMPLOYEE.dbo.LEAVERS
SET JOB = JOBTITLE
STARTDATE = CONVERT(Char,b.DATEOFJOIN,103)
FROM EMPLOYEE.dbo.LEAVERS a JOIN EMPLOYEE.dbo.MASTER b
ON a.STAFFNO = b.STAFFNO
WHERE LEAVEDATE IS NOT NULL
I would like to create an update trigger to do this as soon as the LEAVEDATE is entered but do not know now to write triggers. Can anyone help me with a code example?