You can translate the question and the replies:

Type conversion for Decimal point

HI, I am using the following formula, (qccount/transvalue) The value for qccount = 1 transvalue=47 so output is 1/47 = 0.021276596 but i am getting the 0 only. I tried to use cast('double',(qccount/transvalue)) but the output is 0.0 only and another way cast((qccount/transvalue) as decimal(10,2)) but the output is 0 only. Please help on this to display the out put is 0.02 only. Regards, Senthil
08-05-2018 08:36:23 -0400

1 Answer

Hi, You can convert the input data from integer to decimal and then try to convert output data to desired decimal precision. In your example, I would use the below script to retrieve the desired result. cast ((cast (qccount as decimal) / cast (transvalue as decimal)) as decimal(10,2)) For more details, you can refer to [Type Conversion Functions]( of Virtual Dataport VQL guide. Hope this helps!
Denodo Team
09-05-2018 05:00:45 -0400
You must sign in to add an answer. If you do not have an account, you can register here