I want to concatenate 5 address fields into 'address'. I want to add a comma between each field. I want to bypass 'prstr2' if it is nulls. Here is my statement:
select prcnm, rtrim(prstr1) + ', ' + IsNull(prstr2, '', rtrim(prstr2) + ', ') + rtrim(prcty1)
+ ', ' + rtrim(prsta1) + ' ' + rtrim(przip1) as address, prjob1, prsrg, jbjob, spspnm
from prpms, prpjb, prpsp
where prjob1 = '01118' and jbjob = prjob1 and prtec = ' ' and pren = spen
order by pren desc
I'm getting the 'The isnull function requires 2 arguments' error.
select prcnm, rtrim(prstr1) + ', ' + IsNull(prstr2, '', rtrim(prstr2) + ', ') + rtrim(prcty1)
+ ', ' + rtrim(prsta1) + ' ' + rtrim(przip1) as address, prjob1, prsrg, jbjob, spspnm
from prpms, prpjb, prpsp
where prjob1 = '01118' and jbjob = prjob1 and prtec = ' ' and pren = spen
order by pren desc
I'm getting the 'The isnull function requires 2 arguments' error.