Reputation: 42853
When use numeric type, for example like this numeric(4,2)
and if store in him number 1.2
, at end of number are adding zeros for filling scale
part right? that is result is 1.20
There is possible to save "short" scale as "short"? that is without adding zeros at end ?
Upvotes: 1
Views: 1976
Reputation: 5145
You shouldn't worry about extra space used for scale
part.
According to documentation values of numeric type saved without trailing zeroes:
Numeric values are physically stored without any extra leading or trailing zeroes. Thus, the declared precision and scale of a column are maximums, not fixed allocations. (In this sense the numeric type is more akin to varchar(n) than to char(n).) The actual storage requirement is two bytes for each group of four decimal digits, plus three to eight bytes overhead.
Upvotes: 4