sql server 2008 r2 中的数字 (18, 0) 是什么 [英] what is numeric(18, 0) in sql server 2008 r2

查看:31
本文介绍了sql server 2008 r2 中的数字 (18, 0) 是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从该数据类型中找到了一个包含此列的表

I found a table with this a column from this data type

numeric(18, 0)

请问这是什么?以及为什么 018 的意思是

what is that please? and why does 0 and 18 mean

我已经检查过这个问题数字、浮点数和SQL Server 中的小数,但无法理解.

I already check this question Difference between numeric, float and decimal in SQL Server but couldn't understand it.

我可以在该列中添加 (-10) 吗?

can I add (-10) in that column?

我可以在该列中添加所有负数吗?

can I add all negative number in that column?

我可以在该列中添加任何正数吗?

can I add any positive number in that column?

这是我在该列中找到的数据样本

This is a sample of the data I found in that column

100
263
13
2
9
4
3
3
28
15
33
16
135
50
64
60
100
500
150

更新 2是否可以有 -+ ?

Update 2 Is it possible to have - and + ?

推荐答案

第一个值是precision,第二个是scale,所以 18,0 本质上是 18 位数字,小数点后为 0 位.例如,如果您有 18,2,您将有 18 位数字,其中两位将在小数点后...

The first value is the precision and the second is the scale, so 18,0 is essentially 18 digits with 0 digits after the decimal place. If you had 18,2 for example, you would have 18 digits, two of which would come after the decimal...

18,2 示例:1234567890123456.12

example of 18,2: 1234567890123456.12

numericdecimal 之间没有 功能 区别,除了名称和我想我记得首先是数字,如较早的版本.

There is no functional difference between numeric and decimal, other that the name and I think I recall that numeric came first, as in an earlier version.

然后回答,我可以在该列中添加 (-10) 吗?" - 可以.

And to answer, "can I add (-10) in that column?" - Yes, you can.

这篇关于sql server 2008 r2 中的数字 (18, 0) 是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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