Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Never seen this one before... what do I do?
Message
From
01/07/1999 01:32:36
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00236177
Message ID:
00236308
Views:
13
>I have a SELECT statement which uses a function that returns a numeric value as one of the fields, like so...


>
>SELECT table.fieldone, table.fieldthree, table.fieldthree,;
>GetAmount(table.duedate) AS howmuch ;
>FROM table ;
>INTO CURSOR cTemp
>
>
>The problem is this, I have used the debugger to confirm that the function returns values with decimals, like 524.56, BUT the amount that ends up in the "howmuch" field from the AS part of the SELECT statement is 525, not 524.56. So, how do I maintain the decimals when I get the value from a function called within a SELECT statement?

You have to tell SQL parser what the format will your column use... like this:

SELECT table.fieldone, table.fieldthree, table.fieldthree,;
00000000000.00+GetAmount(table.duedate) AS howmuch ;
FROM table ;
INTO CURSOR cTemp

This should give you a N(14,2) in the howmuch column.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform