Connecting Tech Pros Worldwide Forums | Help | Site Map

Update Trigger

Newbie
 
Join Date: Sep 2006
Location: Indianapolis
Posts: 2
#1: Nov 22 '06
I am trying to write an update trigger that will send one field from one table (header) to update one field in another table (multiple rows though). Here is what I have so far, the syntax is accepted, but I get an error on the front end of the software. Any ideas are appreciated.
Thanks,
Ryan

CREATE TRIGGER UPDATEUPR00400 ON [dbo].[UPR00100]

FOR UPDATE

AS



/*

11/21/2006

The master table is UPR00100 and the field in question is WRKRCOMP.

When this value is changed, they want to update all records in UPR00400 for the same employee. The field to update in the UPR00400 table is WRKRCOMP.

The condition is that UPR00400.WRKRCOMP is not blank and it is different from UPR00100.WRKRCOMP.


*/





insert into upr00400.wrkrcomp

select a.wrkrcomp

FROM UPR00100 a INNER JOIN update i ON a.employid = i.employid

Go

Newbie
 
Join Date: Sep 2006
Location: Indianapolis
Posts: 2
#2: Nov 22 '06

re: Update Trigger


Okay, I update my syntax a bit for an update statement, but getting a syntax error now.

CREATE TRIGGER UPDATEUPR00400 ON [dbo].[UPR00100]

FOR UPDATE

AS


update dbo.upr00400

set upr00400.wrkrcomp=a.wrkrcomp


FROM UPR00100 a INNER JOIN update i ON a.employid = i.employid

Go
Reply