When defining a column's data type decimal in SQL Server, you must specify its precision and number of decimal places.
Precision: the total number of digits in the decimal place, including the digits on the left and right of the decimal point. The precision must be between 1 and 38. The default precision is 18.
Decimal places: the maximum number of digits in decimal places that can be stored on the right of the decimal point. The number of decimal places must be between 0 and P. The number of decimal places can be specified only after the precision is specified. The default number of decimal places is 0. Therefore, 0 <= S <= P. The maximum storage size varies based on precision.
When calling the sqlparameter parameter in C sharp, you also need to specify the parameter precision and the decimal number. The following example declares a decimal type parameter with the precision of 2 in 18 small trees:
Code
Sqlparameter parm = new sqlparameter ("@ parmname", sqldbtype. decimal );
Parm. Precision = 18;
Parm. Scale = 2;
Go to: Link to yukai technical blog