DATA CONVERSION (%)
Teradata Teradata Discussion Forums Teradata.com Discussion Forum
Visit Teradata.com
Home       Guidelines    Member List
Welcome Guest ( Login | Register )
        


This online forum is for user-to-user discussions of Teradata products, and is not an official customer support channel for Teradata. If you require direct assistance, please contact Teradata support.


DATA CONVERSION (%) Expand / Collapse
Author
Message
Posted 2/7/2008 4:22:46 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 11/5/2008 12:43:58 AM
Posts: 3, Visits: 18
This line of code is dividing two previous columns in my table and displaying the result as a %. However, if the correct answer to the division is 58.75% the calculation is displaying the result as 58.00%. This is throwing all my results off.


CAST((COALESCE(PAYPAL.PP_GMB_AUD,0)) AS DEC (18,2)) / CAST((COALESCE(TOTAL.TOTAL_GMB_AUD,0)) AS DEC (18,2)) AS PP_GMB_CONV


Can someone suggest how the results get displayed as they should.

THANKS - dbread007
Post #10521
Posted 2/7/2008 9:48:20 PM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: 11/25/2008 1:20:39 PM
Posts: 91, Visits: 119
Looks like something is casting as integer. You must have left something out of the code you included - calculating a percent would result in .58 and not 58.0. Are you multiplying by 100? If so be sure to case the literal 100 as decimal.
Post #10523
Posted 2/20/2008 6:46:58 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 8/27/2008 5:18:42 AM
Posts: 11, Visits: 47
As Jeff pointed out your calculation is giving 0.5875 but casetd as decimal ( 18,2) which is 0.58 and this multiplied by 100 or 100.00 will give you 58%. better try castingas float to get accurate answers.

Latesh
Post #10643
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 ( 0 guests, 0 members, 0 anonymous members )
No members currently viewing this topic.


All times are GMT -5:00, Time now is 5:04pm

Powered By InstantForum.NET v4.1.4 © 2008
Execution: 0.156. 8 queries. Compression Disabled.