Link to home
Start Free TrialLog in
Avatar of ralph_rea
ralph_rea

asked on

trigger sql server

Hi,
I've these tables:

CREATE TABLE [afm].[wr](
      [ac_id] [char](32) NULL DEFAULT (null),
      [wo_id] [int] NULL DEFAULT (null),
      [wr_id] [int] IDENTITY(1,1) NOT NULL)
      
      
CREATE TABLE [afm].[wo](
      [ac_id] [char](32) NULL DEFAULT (null),
      [wo_id] [int] IDENTITY(1,1) NOT NULL)
      

I'd like to create a trigger that fire when:

- update or insert into wr

- wr.wo_id is not null and wr.wo_id=wo.wo_id

this trigger have to update wo.ac_id with wr.ac_id values

How can I write this trigger?

Thanks in advance!

Raf
Avatar of ralph_rea
ralph_rea

ASKER

sorry.....
the steps are:
insert into wr (trigger not file because wo_id is null)
update wr.wo_id with one value (here trigger must fire and update wo.ac_id with wr.ac_id values)
ASKER CERTIFIED SOLUTION
Avatar of openshac
openshac

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial