General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
FoxPro 2.6 would set the length of a numeric field to whatever was needed to store the value in the first record selected. I haven't tried to see if VFP behaves the same way. I was experiencing a problem in 2.6 similar to Mark and it took me forever to figure out what was going on. I seem to remember using the "0.000" to fix the problem. Maybe VFP behaves differently.
>I can't tell you for sure. The way that I learned this was trying to get an empty numeric field in the results of a cursor, and getting it big enough to be able to put decimals in later.
>
>SELECT 0.000 AS NumField
>
>did not work.
>
>SELECT 1.000 * 0 AS NUmField
>
>Does. Go figure. Something to do with how SQL decides to format the column before the SELECT ever runs.
>
>
>>THANKS Erik... that worked perfectly! But that is a "work around" isn't it? Am I not understanding something, why does it drop the decimals when the return value at the RETURN statement in the function has the decimals???
>>
>>>Try this:
>>
>>> SELECT table.fieldone, table.fieldthree, table.fieldthree,;
>>> 1.000 * GetAmount(table.duedate) AS howmuch ;
>>> FROM table ;
>>> INTO CURSOR cTemp
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only