I am browsing the SQL Server Management Studio Object Explorer: the metadata. Under the TempDb > Views > System Views > Columns object I find: "Numeric Precision Radix". I know what radix means (binary, decimal, hexidecimal, etc) and what Numeric Precision means (how many digits are in the representation of the number, and Scale: how many digits are after the radix point).
But how can the metadata itself (Numeric Precision) have a Radix (system of encoding)? It is like saying what color is the CAN of paint?
And why can't I find a description of this phrase anywhere? Thank you.
I believe that Numeric_Precision_Radix
is specified in the Information_Schema.Columns table as specified by the SQL-99 standard.
It will be different for each DBMS. according to this link it is specified as:
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.
For SQL Server it is 10 for int
, money
and decimal
and 2 for float
& real
. See below for example where for float where the radix is 2 and the precision is 53, meaning that the it is precise to 53 bits of information.
In other words for int precision is expressed in terms 10 to the power of 10 but for real it is expressed as 2 to the power of 53.
See wiki link here
MS SQL Server 2008 Schema Setup:
CREATE TABLE MyRadix
(
aInt int,
bFloat float,
cMoney Money,
dDecimal Decimal(12,10),
eReal Real
)
Query 1:
SELECT COLUMN_NAME, DATA_TYPE, NUMERIC_PRECISION_RADIX, NUMERIC_PRECISION, NUMERIC_SCALE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'MyRAdix'
| 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) |
来源:https://stackoverflow.com/questions/28835640/what-does-numeric-precision-radix-mean-in-the-sql-server-metadata