Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL formatiing question
Message
From
21/07/1999 08:18:47
 
 
To
20/07/1999 15:57:33
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00243666
Message ID:
00244059
Views:
15
thanks - I gues I've been trying to avoid the 'string conversion and back' tricks - was hoping forsomething more native to SQL and numbers.
Thanks for replies!
Ken

>This is untested, but would val(str(qty*price, 14, 4)) return the proper digits?
>
>>Fred,
>>
>>That great for 'expanding' the format, and I do it like that where I can, but unfortunately, that method doesn't work for narrowing the format down, and that's what I need.
>>
>>Ken
>>
>>>>Hi,
>>>>
>>>>what is the best way to 'force' SQL to formatt a numeric field to a certain width and decimals? For example, suppose I have QTY as 14,4 field and PRICE as an 14, 4 also. when I do a select QTY * PRICE as TOTAL, it ends up as a 20, 4 field when all I may really want is another 14,4 or even a 10,2 depending on what I'm doing. This gets even more complicated when using UNION between varying length fields in different cursors.
>>>>
>>>>Ideas?
>>>>
>>>>Thanks!
>>>>Ken
>>>
>>>Add a 0 value in the format you want:
>>>
>>>SELECT (qty*price)+00000000000.00 AS total ....
Ken B. Matson
GCom2 Solutions
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform