>>>>LTRIM(STR(YEAR(AddDate)))
>>>>works for me in VFP and SQL. You don't need rtrim().
>>>
>>>Ok, but there is still the issue of extra spaces. As I need to use that field for comparism down under, it would have been nice to trim it entirely.
>>
>>I meant it trims entirely for me :) With numeric values converted with str() I don't see any trailing spaces.
>
>I tried it again and the following:
>
>
>SQLExec(lnHandle,'SELECT LTRIM(STR(YEAR(AddDate))) FROM News')
>
>
>generates trailing spaces.
Michel,
I think I understand what you mean now. If result datatype was a memo then trailer wouldn't occur ( or if you specify size with convert(char(4),year(adddate)), str(year(adddate),4) )
Specifying the size would work for you here since you know result would always be 4 (at least for our lifespan)
Otherwise you could prevent trailing forcing the datatype to memo.
cursorsetprop('UseMemoSize',1,0)
SQLExec(lnHandle,'SELECT LTRIM(STR(YEAR(AddDate))) as cYear FROM News')
? cYear+'A'
Cetin