This repository has been archived on 2024-11-28. You can view files and clone it, but cannot push or open issues or pull requests.
LuisLeon_FactuGES/Database/Script.txt

33 lines
847 B
Plaintext

ALTER TABLE ALBARANES_CLIENTE_DETALLES
ADD ID_PEDIDO TIPO_ID;
update albaranes_cliente_detalles
set id_pedido = (select albaranes_cliente.id_pedido
from albaranes_cliente
where albaranes_cliente.id = albaranes_cliente_detalles.ID_ALBARAN);
ALTER TABLE ALBARANES_PROVEEDOR_DETALLES
ADD ID_PEDIDO TIPO_ID;
update albaranes_proveedor_detalles
set id_pedido = (select albaranes_proveedor.id_pedido
from albaranes_proveedor
where albaranes_proveedor.id = albaranes_proveedor_detalles.ID_ALBARAN);
CREATE TRIGGER FACTURAS_CLIENTE_DELETE FOR FACTURAS_CLIENTE
ACTIVE BEFORE DELETE POSITION 0
AS
begin
update albaranes_cliente
set albaranes_cliente.fecha_recepcion = null
where albaranes_cliente.id_factura = id_factura;
end
^
SET TERM ; ^