Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
1.12/5 (3 votes)
See more:
I want convert 1.28883736305216E+306 to decimal(18,2)
Posted
Updated 5-Aug-15 0:39am
v2
Comments
[no name] 5-Aug-15 7:00am    
SELECT CAST (1.28883736305216E+306 AS DECIMAL(18,2))
-->
Msg 8115, Level 16, State 6, Line 2
Arithmetic overflow error converting float to data type numeric.

Can you imagine why?

The scientific notation you used, means that the number has 307! significant digits (actually all digits BEFORE the decimal point are significant)...
A decimal type can hold up to a maximum of 38 digits[^] BEFORE the decimal point, so the maximum of the E value is 38!!!
For that a float with E value of 306 can not be converted to decimal!!!

 
Share this answer
 
v2

It's Not possible to convert into the decimal try to display in float only.


If you want to get more idea see below link:


http://www.sqlservercentral.com/Forums/Topic1233290-391-1.aspx[^]

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900