1

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 ?

Milen A. Radev
  • 60,241
  • 22
  • 105
  • 110
Oto Shavadze
  • 40,603
  • 55
  • 152
  • 236

1 Answers1

4

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.

Maxim Kolesnikov
  • 5,075
  • 6
  • 38
  • 68