SQL Decimal & float & celling Introduction

Source: Internet
Author: User

decimal can be used to specify a few digits such as 123.456, Decimal (3,3), which is more accurate with this type of calculation.

By default, when you convert a number to a decimal or numeric value that has a lower precision and scale , SQL Server rounds

DECLARE @number decimal (38,2) = 123.456; result = 123.46

float can be 15 bytes by default, and if the bytes that are exceeded are rounded,

Like what

1.999999999999991 = 1.99999999999999

1.999999999999998 = 2

If you want better performance, you can put a variable, byte can be up to 7

https://msdn.microsoft.com/zh-cn/library/ms187746 (v=sql.110). aspx

https://msdn.microsoft.com/zh-cn/library/ms173773 (v=sql.110). aspx

Celling

This cannot be used after floating point, but if you add the $ symbol you can celling percent

https://msdn.microsoft.com/en-us/library/ms189818 (v=sql.110). aspx

SQL Decimal & float & celling Introduction

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.