Dave,
I see you are using VFP 9, so You could use just ltrim + cast to remove the left zeroes
SELECT ;
Cast(ltrim(a1.Client_no, 0, '0') as C(10)) as Field1, ;
...
> Why would TRANSFORM(VAL(a1.Client_No)) return '1' given a1.Client_No = '0000197652', instead of the ALLTRIM(STR(VAL(a1.Client_No))) below which correctly returns '197652'?
>
> I had also written a UDF to just trim off the leading zeros, and it returned '1'. Actually, the UDF had '197652' when it headed back to the select statement, but '1' wound up in Field1.
>
> Can none of the vfp functions be trusted in SQL code?
>
> What am I missing?
>
> Dave
>
>
> SELECT ;
> ALLTRIM(STR(VAL(a1.Client_No))) as Field1, ;
> cInvoiceNo as Field2, ;
> CopDate(DATE()) as Field3, ;
> ALLTRIM(a1.Sap_Code) as Field7 ;
> FROM alsCompany a1 ;
> WHERE a1.Co_Number = nCo_Number ;
> INTO CURSOR csrH1
>
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?
"To die for a religion is easier than to live it absolutely"
Jorge L. Borges