Hi Thomas
> guess thats SPT !? coz name should be a string field or Cast into one !?
>
> > Regards
> > Andy Kramek
> > Microsoft MVP (Visual FoxPro)
> >
Tightline Computers Inc, Akron Ohio, USANope! This is straight VFP and even doing a CAST wouldn't help. The problem is that you can get a NULL from an OUTER JOIN - unless you specifically check for it and negate it using NVL() you will still get this problem. The correct query would be:
In VFP:
SELECT CPY.company_name, NVL( CTC.firstname, "" ) AS firstname, NVL( CTC.lastname, "" ) AS lastname ;
FROM company CPY ;
LEFT OUTER JOIN contacts CTC ON CTC.companyfk = CPY.companypk ;
WHERE CPY.company_name LIKE "A%" ;
INTO CURSOR cur_list
For SQL Server:
SELECT CPY.company_name, ISNULL( CTC.firstname, "" ) AS firstname, ISNULL( CTC.lastname, "" ) AS lastname ;
FROM company CPY
LEFT OUTER JOIN contacts CTC ON CTC.companyfk = CPY.companypk
WHERE CPY.company_name LIKE "A%"
Regards
Andy Kramek
Microsoft MVP (Visual FoxPro)
Tightline Computers Inc, Akron Ohio, USA