I am struggling a little with the addresses of the business partner. I am aware that the addresses are stored in CRD1 and that the key ADDRESS is identical with the BILLTODEF in OCRD für the Bill-to address.
We now have updated the field BILLTODEF in OCRD and now I am trying to do the update in the regarding rows in CRD1.
set address = (
select billtodef from ocrd
where cardcode = crd1.cardcode
and crd1.adrestype = 'B'
and billtodef is not NULL
Now I am getting an error message that address cannot accept a NULL value which I thought would be avoided by the last search clause.
When I run the following SQL, I get the list of all BPs that have a Null value in BILLTODEF. Inserting a NOT NULL gives all the other BPS.
select cardcode, cardtype, billtodef from ocrd
where billtodef is null
Now I am wondering why the the search condition in the first UPDATE statement doesn't work.
Any hint is appreciated.