/* JP20071002 Fix packet forreign keys */
delete from productprice where not productnumber in (select productnumber from products WITH (nolock))

update productprice set arrivalpacketnumber=null where not arrivalpacketnumber in (select packetnumber from packet WITH (NOLOCK))
update productprice set staypacketnumber=null where not staypacketnumber in (select packetnumber from packet WITH (NOLOCK))
update productprice set departurepacketnumber=null where not departurepacketnumber in (select packetnumber from packet WITH (NOLOCK))

update productprice set arrivalpacketnumber=null where arrivalpacketnumber=0
update productprice set staypacketnumber=null where staypacketnumber=0
update productprice set departurepacketnumber=null where departurepacketnumber=0