1. The round () function is used in rounding. The first parameter is the data to be operated, and the second parameter is used to display the number of decimal places after rounding.
2.The numeric function has two parameters. The first parameter indicates the data length, and the second parameter indicates the number of digits after the decimal point.
For example:
Select cast (round (12.5, 2) as numeric ))Result: 12.50
Select cast (round (12.555, 2) as numeric ))Result: 12.56
Select cast (round (122.5255, 2) as numeric ))Result: 122.53
Select cast (round (1222.5255, 2) as numeric ))Result: an error is returned! The reason is:1222.5255, the integer is 4, the decimal place is 2, and the sum is 4 + 2 = 6, which exceeds the five digits set by Numeric,You can increase or decrease numeric parameters, such as numeric ).
This article is reproduced after a adjustment, reproduced from: http://blog.csdn.net/caoyuanlang_11/article/details/5410833
1. The round () function is used in rounding. The first parameter is the data to be operated, and the second parameter is used to display the number of decimal places after rounding.
2.The numeric function has two parameters. The first parameter indicates the data length, and the second parameter indicates the number of digits after the decimal point.
For example:
Select cast (round (12.5, 2) as numeric ))Result: 12.50
Select cast (round (12.555, 2) as numeric ))Result: 12.56
Select cast (round (122.5255, 2) as numeric ))Result: 122.53
Select cast (round (1222.5255, 2) as numeric ))Result: an error is returned! The reason is:1222.5255, the integer is 4, the decimal place is 2, and the sum is 4 + 2 = 6, which exceeds the five digits set by Numeric,You can increase or decrease numeric parameters, such as numeric ).
this article after the system is reproduced, make an adjustment, reprinted from: http://blog.csdn.net/caoyuanlang_11/article/details/5410833 >