Reputation: 26737
I got a table with the below data in it.
all I need to do is a query the calculate 10% of the damage so I have done the below:
SELECT damage = (damage * 10) /100
,[Peril_Code]
FROM [LocExposure].[dbo].[myTable]
and this return the below result:
[Damage] column is a float .
I cannot figure out why it returns the wrong calculation.
Upvotes: 1
Views: 1049
Reputation: 3821
Your output is correct. No error. Please check the result 2.44E-06
where your actual value was 2.44E-05
.
So, there is no error.
UPDATE:
For avoiding scientific notation, you can go through the following post
convert float into varchar in SQL server without scientific notation
Upvotes: 3
Reputation: 57996
DECLARE @Damage TABLE
(
Damage FLOAT,
PerilCode CHAR(1)
)
INSERT INTO @Damage VALUES
(2.44253351044103E-05 , 'T'),
(0.000125444785042888 , 'T'),
(0.00015258112714104 , 'T'),
(0.000238995871781784 , 'T'),
(0.000267978447740977 , 'T')
SELECT Damage, Damage * 0.1 [10%], PerilCode
FROM @Damage
Output
Damage 10% PerilCode
---------------------------------------------------------
2,44253351044103E-05 2,44253351044103E-06 T
0,000125444785042888 1,25444785042888E-05 T
0,00015258112714104 1,5258112714104E-05 T
0,000238995871781784 2,38995871781784E-05 T
0,000267978447740977 2,67978447740977E-05 T
Upvotes: 1