When defining the data type decimal of a column in sqlserver, the precision and number of decimal places must be specified.
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:
The code is as follows:
SqlParameter parm = new SqlParameter ("@ parmName", SqlDbType. Decimal );
Parm. Precision = 18;
Parm. Scale = 2;