CREATE TRIGGER 部门表_tri before update ON 部门表 for each row begin update 员工表 set 工号 = substr(工号,1,2)||substr(:new.部门号, 3, 1) where substr(工号,1,2)=:old.部门号; end; /
sorry: CREATE TRIGGER 部门表_tri before update ON 部门表 for each row begin update 员工表 set 工号 = :new.部门号||substr(工号,3,1) where substr(工号,1,2)=:old.部门号; end; /
CREATE TRIGGER 部门表修改触发 ON [dbo].[部门表] FOR UPDATE AS update 员工表 set 员工表.工号 = (inserted.部门号 + substring(工号, 3, 1)) from 员工表, inserted, deleted where 员工表.工号 like (deleted.部门号 + '_') AND 员工表.工号 like (inserted.部门号 + '_')
before update ON 部门表
for each row
begin
update 员工表
set 工号 = substr(工号,1,2)||substr(:new.部门号, 3, 1)
where substr(工号,1,2)=:old.部门号;
end;
/
CREATE TRIGGER 部门表_tri
before update ON 部门表
for each row
begin
update 员工表
set 工号 = :new.部门号||substr(工号,3,1)
where substr(工号,1,2)=:old.部门号;
end;
/
FOR UPDATE
AS
update 员工表
set 员工表.工号 = (inserted.部门号 + substring(工号, 3, 1))
from 员工表, inserted, deleted
where 员工表.工号 like (deleted.部门号 + '_')
AND 员工表.工号 like (inserted.部门号 + '_')