How was the Following Value calculated [Resolved]

Posted by Vuyiswamb under Sql Server on 3/6/2013 | Points: 10 | Views : 923 | Status : [Member] [MVP] [Administrator] | Replies : 3
Good Day

i have a RadMaskedTextBox which gets binded with the following value from the DB

<telerik:RadMaskedTextBox IsEnabled="False" Height="22" HorizontalAlignment="Right" Mask="p1" MaskType="Numeric" MaskedText="0" EmptyContent="0" Margin="0,281,880,0" Name="RETURNONASSETS" telerik:StyleManager.Theme="Metro" VerticalAlignment="Top" Width="227" TabIndex="8" SelectionOnFocus="SelectAll" Grid.Column="1" />



<b>0.0473445085040537 </b>

and on the application it format the value as


4.7 %




which is Correct , now i want to understand how did it come to 4.7 , i tried this


    select round(0.0473445085040537,2)

select round(0.0473445085040537,3)


but my calc here does not give me 4.7 , i need help with this TSQL to make it 4.7

Thank you for posting at Dotnetfunda
[Administrator]



Responses

Posted by: Jayakumars on: 3/6/2013 [Member] [MVP] Bronze | Points: 50

Up
0
Down

Resolved
hi

hello Brother Vuyiswamb
check this below Query


Select round(0.0473445085040537,3)%100
output
=========
0.0470000000000000

Select (CONVERT(decimal(10,3), round(0.0473445085040537,3)%100))
output
============
0.047

Select (CONVERT(decimal(10,1), round(0.0473445085040537,3)*100))
output
==========
4.7











Mark as Answer if its helpful to you

Vuyiswamb, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 3/7/2013 [Member] Silver | Points: 25

Up
0
Down
Here u can use Regex...

[1-9][0-9]+


Regards,
Singaravel M

Vuyiswamb, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 3/7/2013 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
Thanks Guys

Thank you for posting at Dotnetfunda
[Administrator]

Vuyiswamb, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response