Subject RE: [ib-support] Calling Stored Procedure in From section of Select Statement
Author Lele Gaifax
>>>>> sugi said:

sugi> What is the proper syntax if we want the selectable
sugi> StoredProc FORMATNAME() to return multiple fields? In your
sugi> example it worked because we only need ONE field from the
sugi> selectable StoredProc.

Something like this should work:

SELECT a.STREET1, a.STREET2, ...
p.FIRSTNAME, p.MIDDLENAME, ...
sp.FULLNAME, sp.CARDID, ...
FROM PERSON p
JOIN ADDRESS a ON (p.PERSONID = a.OWNERID)
LEFT JOIN FORMATNAME(p.FIRSTNAME, p.MIDDLENAME, P.LASTNAME, 'LNF) sp
ON 1=1 /* dummy required condition */

BTW, given that you used an INNER JOIN between PERSON and ADDRESS,
by definition ADDRESS.OWNERID cannot be NULL (well, assuming PERSONID
is the primary key on PERSON)

hth,
ciao, lele.
--
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
email: lele@... | -- Fortunato Depero, 1929.