I am a newby to SQL and I am currently creating a store procedures for Crystal Reports. I have ran into a Problem. Here is some of my coding:
SELECT @Address = ISNULL(Address,'') from tblAddresses WHERE (ClientNumber = @ClientNumber) AND (AddressType = 'Current')
IF LTRim(RTrim(@Address)) <> ''
SELECT @Address = isnull(Address,'') + char(13) + char(10) + isnull(City,'') + ', ' + isnull(State,'') + ' ' + isnull(Zip1,'')
FROM tblAddresses
WHERE (ClientNumber = @ClientNumber) AND (AddressType = 'Current')
ELSE
SELECT @Address = isnull(Address,'') + char(13) + char(10) + isnull(City,'') + ', ' + isnull(State,'') + ' ' + isnull(Zip1,'')
FROM tblAddresses
WHERE (ClientNumber = @ClientNumber) AND (AddressType = 'Mailing')
I must have Current Address and if there is no Current Address I must get the mailing address. I keeping getting null values. I have tried it many different ways and result is null. In AddressType I have 3 different criterias but I only need 2 in this stored procedures. Can anyone help?
Software/Hardware used:
ASKED:
September 14, 2006 6:45 PM
UPDATED:
September 14, 2006 9:47 PM