In sqlserver, the number of digits after the decimal point is retained and round is used.

Source: Internet
Author: User
Round
Returns a numeric expression rounded to the specified length or precision.

The displayed page requires that only four digits after the decimal point be retained. It is found that the number after the four decimal places can be truncated in the round (expression, 4, 1 ).
If (round, 4) is written, it indicates rounding the four digits after the decimal point, but not truncating more 0

B. Use Round And rounded approximate values

The following example shows rounding and approximate values.

Statement Result
Select round (123.4545, 2)
123.4500
Select round (123.45,-2)
100.00

C. UseRoundTruncation

In the following example, two select statements are used to explain the difference between rounding and truncation. The first statement rounds the result. The second statement truncates the result.

Statement Result
Select round (150.75, 0)
151.00
Select round (150.75, 0, 1)
150.00

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.