哪个数据类型在sql中用于小十进制数 [英] Which data Type Use in sql for small decimal numbers

查看:101
本文介绍了哪个数据类型在sql中用于小十进制数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我想在sql server中保存像1.5,-1.12,1,......

这样的数字。

精度会是2位数。



我不知道在sql中使用哪种dataType?



提前谢谢

Hello
I want to save numbers like 1.5,-1.12,1,...
in sql server.
precision would be 2 digit.

I dont know which dataType use in sql?

Thank you in advance

推荐答案

尝试 DECIMAL [ ^ ]


SQL中支持小数点的最小类型是smallmoney(占用4个字节),但使用它可能会让您或其他人感到困惑。 。

所以我建议使用低精度的十进制(数字)(1到9)。它将使用5个字节的存储空间,以后可以自我解释...

https://msdn.microsoft.com/en-us/library/ms187746.aspx [ ^ ]
The smallest type in SQL that support decimal point is smallmoney (taking up 4 bytes), but using it can confuse you or others later...
So I would suggest to use decimal (numeric) with low precision (1 to 9). It will use 5 bytes of storage and will be self explanatory for later...
https://msdn.microsoft.com/en-us/library/ms187746.aspx[^]


从我的角度来看这是一个很好的问题。我希望这会给你一些信息。我还在学习这个。

http://stackoverflow.com/questions/3152439/what-is-a-good-mapping-of-net-decimal-to-sql-server-decimal [< a href =http://stackoverflow.com/questions/3152439/what-is-a-good-mapping-of-net-decimal-to-sql-server-decimaltarget =_ blanktitle =新窗口> ^ ]

希望有所帮助。
A good question from my Point of view. I hope this would give you some Information. I'm also still learning about this.
http://stackoverflow.com/questions/3152439/what-is-a-good-mapping-of-net-decimal-to-sql-server-decimal[^]
Hope it helps.


这篇关于哪个数据类型在sql中用于小十进制数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆