Type mapping
Https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/sql-server-data-type-mappings
C # Keywords
decimal
Https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/decimal
The decimal
keyword indicates a 128-bit data type.
Compared to other floating-point types, the decimal
type have more precision and a smaller range, which makes it appropriate For financial and monetary calculations.
The approximate range and precision for the decimal
type is shown in the following table.
Range of values ( -7.9 x 1028 to 7.9 x 1028)/(from 1028)
Accuracy 28-29 significant digits
Int
Https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/int
int
Denotes an integral type This stores values according to the size and range shown in the following table.
Value range -2,147,483,648 to 2,147,483,647
Size signed 32-bit integer
In SQL Server
Https://docs.microsoft.com/en-us/sql/t-sql/data-types/decimal-and-numeric-transact-sql
Numeric data types that has a fixed precision and scale. Decimal and numeric is synonyms and can be used interchangeably.
decimal [ (p[ ,s] )] and numeric[ P[, S] )]
Fixed precision and scale numbers.
When maximum precision was used, valid values is from-10^38 +1 through 10^38-1.
The ISO synonyms for decimal is Dec and Dec (P, s).
numeric is functionally equivalent to decimal.
P (Precision)
The maximum total number of a decimal digits that would be stored, both to the left and to the right of the decimal point.
The precision must is a value from 1 through the maximum precision of 38. The default precision is 18.
s(scale)
The number of decimal digits that would be stored to the right of the decimal point.
This was subtracted from p to determine the maximum number of digits to the left of the decimal point.
The maximum number of decimal digits that can is stored to the right of the decimal point.
Scale must is a value from 0 through p.
Scale can specified only if precision is specified.
The default scale is 0; Therefore, 0 <= s <= p.
Maximum storage sizes vary, based on the precision.
Example
Numeric (18,2) range of values
Max 9999999999999999.99 decimal Right two digits, left 16 digits
numeric and int in SQL Server