MS SQL Server十进制数据类型向上舍入

时间:2021-12-01 15:35:29

I need to be able to store numbers like 3.5 in my table. So I've used the decimal type field. But if I enter 3.5 it round it up to 4. Am I being stupid or is it not the point of decimal to have a decimal point?

我需要能够在我的表中存储像3.5这样的数字。所以我使用了十进制类型字段。但是如果我输入3.5它会将它四舍五入到4.我是愚蠢的还是小数点不是小数点?

1 个解决方案

#1


13  

You need to declare it like decimal(18,3) to specify the number of digits after the point.

您需要将其声明为十进制(18,3)以指定该点后的位数。

#1


13  

You need to declare it like decimal(18,3) to specify the number of digits after the point.

您需要将其声明为十进制(18,3)以指定该点后的位数。