我正在浏览 SQL Server Management Studio 对象资源管理器:元数据。在 TempDb > View > 系统 View > 列对象下,我找到:“数字精度基数”。我知道基数的含义(二进制、十进制、十六进制等)以及数字精度的含义(数字的表示形式有多少位,以及小数位数:小数点后面有多少位)。
但是元数据本身(数字精度)如何具有基数(编码系统)?这就好比说油漆的CAN是什么颜色?
为什么我在任何地方都找不到这个短语的描述?谢谢。
最佳答案
我相信 Numeric_Precision_Radix
是按照 SQL-99 标准在 Information_Schema.Columns 表中指定的。
每个 DBMS 都会有所不同。 根据这个link它被指定为:
If data_type identifies a numeric type, this column indicates in which base the values in the columns numeric_precision and numeric_scale are expressed. The value is either 2 or 10. For all other data types, this column is null.
对于 SQL Server,int
、money
和 decimal
为 10,float
和 为 2 >真实
。请参阅下面的示例,其中对于 float,基数为 2,精度为 53,这意味着它精确到 53 位信息。
换句话说,int 精度用 10 的 10 次方表示,但对于实数,它表示为 2 的 53 次方。
参见维基link here
MS SQL Server 2008 架构设置:
CREATE TABLE MyRadix
(
aInt int,
bFloat float,
cMoney Money,
dDecimal Decimal(12,10),
eReal Real
)
查询 1:
SELECT COLUMN_NAME, DATA_TYPE, NUMERIC_PRECISION_RADIX, NUMERIC_PRECISION, NUMERIC_SCALE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'MyRAdix'
<强> Results :
| COLUMN_NAME | DATA_TYPE | NUMERIC_PRECISION_RADIX | NUMERIC_PRECISION | NUMERIC_SCALE |
|-------------|-----------|-------------------------|-------------------|---------------|
| aInt | int | 10 | 10 | 0 |
| bFloat | float | 2 | 53 | (null) |
| cMoney | money | 10 | 19 | 4 |
| dDecimal | decimal | 10 | 12 | 10 |
| eReal | real | 2 | 24 | (null) |
关于sql-server - "numeric precision radix"在 SQL Server 元数据中意味着什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28835640/