saludos
tengo un problema con este trigger. se supone que cuando actualice el valor
de terminado de la tabla oficha, el trigger deberia cambiar el estado de la
tabla oficha_evt_oficha.
pero al instalarlo, e insertar un nuevo registro, el trigger se dispara.
pero se supone que no se debe disparar para in insert sino para un update y
solo del campo terminado.
alguna sugerencia?
Otra pregunta seria si se puede tener dos sentencia sql dentro del mismo
trigger como esta este?
Gracias por sus comentarios
CREATE TRIGGER [hl7_oficha] ON [oficha]
FOR UPDATE
AS
IF UPDATE (terminado)
update evt_oficha set state = 1 from inserted, oficha where
oficha.ficha_order = inserted.ficha_order and oficha.ficha_date =
inserted.ficha_date and evt_oficha.state = 0 and oficha.terminado = 1
update evt_oficha set state = 3 from inserted, oficha where
oficha.ficha_order = inserted.ficha_order and oficha.ficha_date =
inserted.ficha_date and evt_oficha.state = 2 and oficha.terminado = 1
Leer las respuestas