如何解释数据库中数字的精度和比例? - How do I interpret precision and scale of a number in a database?

10/14 11:20
阅读数 0

问题:

I have the following column specified in a database: decimal(5,2) 我在数据库中指定了以下列:decimal(5,2)

How does one interpret this? 怎么解释这个?

According to the properties on the column as viewed in SQL Server Management studio I can see that it means: decimal(Numeric precision, Numeric scale). 根据SQL Server Management Studio中查看的列上的属性,我可以看到它表示:十进制(数字精度,数字刻度)。

What do precision and scale mean in real terms? 精确度和规模在实际意义上是什么意思?

It would be easy to interpret this as a decimal with 5 digits and two decimals places...ie 12345.12 很容易将其解释为带有5位数和2位小数位的十进制数...即12345.12

PS I've been able to determine the correct answer from a colleague but had great difficulty finding an answer online. PS我已经能够从同事那里确定正确的答案,但很难在网上找到答案。 As such, I'd like to have the question and answer documented here on stackoverflow for future reference. 因此,我想在stackoverflow上记录问题和答案,以备将来参考。


解决方案:

参考一: https://en.stackoom.com/question/9yPW
参考二: https://stackoom.com/question/9yPW
展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部