Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP WITH TRIGGER

Status
Not open for further replies.

mentasses

Technical User
Mar 23, 2004
29
GB
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?
 
CREATE TRIGGER Leaver_Trig
ON MASTER
FOR UPDATE
AS

Your code

GO

[bandito] [blue]DBomrrsm[/blue] [bandito]
 
I tried adding the code but the record does not update when I enter the leaving date?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top