Tuesday, January 26, 2016

JDE clean up of payment tables when supplier hold code causes orphaned records

select * from uspddta.F04571;

select * from uspddta.F04572;

select * from uspddta.F04573;

select * from uspddta.F0411 where rppst = '#';

UPDATE uspddta.F0411
SET rppst = 'A'
WHERE
rppst = '#' and exists(select * from uspddta.F04573 where rpkco = kikco and rpdoc = kidoc and rpdct = kidct and rpsfx = kisfx and kihdc = 27252);

DELETE uspddta.F04573 WHERE kihdc = 27252;
DELETE uspddta.F04572 WHERE NOT EXISTS (SELECT * FROM uspddta.F04573 WHERE  kihdc = kkhdc AND kickc = kkckc);

DELETE uspddta.F04571 where not exists (select * from uspddta.F04572 where  kkhdc = khhdc);

No comments:

Post a Comment