>Hi All,
>
>Can I include the ORDER BY clause in my command when using SPT ?
>When I try to execute this command using SPT I am getting "Command contains unrecogized command/phrase" error.When I run it without the ORDER By clause it runs ok.
>
>lcCommand="SELECT cbudid, cacctid, cdescript, ccode, ncpdamt1, ncpdamt2, ncpdamt3, ncpdamt4, ncpdamt5, ncpdamt6, ncpdamt7, ncpdamt8, ncpdamt9, ncpdamt10, ncpdamt11, ncpdamt12, total, cid FROM bdgt01 WHERE cacctid IN(SELECT cacctid FROM dbo.glacct_cp WHERE lbudget=1) ORDER BY cacctid, cbudid, ccode"
>
Hi Daniel,
I don't see anything wrong with select itself. If there was, you would get an ODBC error not VFP error. The error message indicates that error is in your VFP code. The lenght of a string literal in VFP is limited to 255 charcters.
Btw, how can you debug code that you cannot even read w/o endless scrolling? Ii's bettere to use TextMerge to make code readable and avoid a string literal lenght limitation.
TEXT TO lcCommand TEXTMEGE NOSHOW
SELECT cbudid, cacctid, cdescript, ccode, ncpdamt1, ncpdamt2,
ncpdamt3, ncpdamt4, ncpdamt5, ncpdamt6, ncpdamt7, ncpdamt8,
ncpdamt9, ncpdamt10, ncpdamt11, ncpdamt12, total, cid
FROM bdgt01
WHERE cacctid IN (SELECT cacctid FROM dbo.glacct_cp WHERE lbudget=1)
ORDER BY cacctid, cbudid, ccode
ENDTEXT
--sb--