This is our generic address function that we call into each report that needs an address block.
The goal here is RAD - Rapid Application Development. If we write a function once we blog it here... so it doesn't have to be written again.
Use it like this:
select
h.sopnumbe,
dbo.ddf_Address(h.CUSTNAME, SHIPTO.CNTCPRSN, SHIPTO.ADDRESS1, SHIPTO.ADDRESS2, SHIPTO.ADDRESS3, SHIPTO.CITY, SHIPTO.STATE, SHIPTO.ZIP)
as
address
from
sop10100 h
join
rm00102 SHIPTO
on
SHIPTO.custnmbr = h.custnmbr
and
SHIPTO.ADRSCODE = h.PRSTADCD