Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Decimal precision - C#

Tags:

c#

All,

For a decimal value of 1 billion being retrieved from SQL Server where the associated datatype is Numeric (28,10), I am running into Conversion overflow exception. From MSDN:

The .NET Framework decimal data type allows a maximum of 28 significant digits

I need to clarify if the digits here refer to the binary form or decimal form itself?

like image 498
name_masked Avatar asked Jan 18 '26 20:01

name_masked


2 Answers

In SQL Server for Numeric and Decimal datatypes, this defines a maximum of 28 decimal digits in total (the precision) with a maximum of 10 decimal places to the right of the decimal point (the scale), thus giving a maximum of 18 dp to the left of the point.

like image 117
Barry Kaye Avatar answered Jan 21 '26 08:01

Barry Kaye


The limitation is imposed by the decimal representation and the 28 significant digits refer to 28 decimal digits.

like image 24
David Heffernan Avatar answered Jan 21 '26 09:01

David Heffernan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!