Ver Mensaje Individual
  #21  
Antiguo 31-01-2016
toni.vi toni.vi is offline
Miembro
 
Registrado: may 2003
Ubicación: Sant Fost(Barcelona)
Posts: 102
Reputación: 21
toni.vi Va por buen camino
Jack
Entiendo tu problema, y no se porque no te funciona, a mi me funciona correctamente. Te paso mi codigo para que lo revises respecto al tuyo.
Solo añadir que tambien debes crear un trigger para beforeinsert

Código SQL [-]

CREATE TRIGGER FGEHIMAR_BU0 FOR FARTICULO
ACTIVE BEFORE INSERT OR UPDATE POSITION 1
AS
begin
  /* Trigger text */
  update FARTICULO
  set FARTICULO.STOCK = coalesce(FARTICULO.STOCK,0) - old.cantidad
  where FARTICULO.articulo  = old.Articulo;

end
^

CREATE TRIGGER FGEHIMAR_AU0 FOR FARTICULO
ACTIVE AFTER UPDATE POSITION 0
AS
begin
  /* Trigger text */

  update FARTICULO
  set FARTICULO.STOCK = coalesce(FARTICULO.STOCK,0) + new.cantidad
  where FARTICULO.articulo  = new.Articulo;

end
^
Responder Con Cita