This is what we can read on the Sybase SQL Server Reference Manual:

Decimal Datatypes

SQL Server provides two other exact numeric datatypes, numeric and
ec[ imal], for numbers that include decimal points. Data stored in numeric
and decimal columns is packed to conserve disk space, and preserves its
accuracy to the least significant digit after arithmetic operations. The
numeric and decimal datatypes are identical in all respects but one: only
numeric datatypes with a scale of 0 can be used for the IDENTITY column.


(...) some lines after:

Storage Size

The storage size for a numeric or decimal column depends on its precision.
The minimum storage requirement is 2 bytes for a 1- or 2-digit column.
Storage size increases by 1 byte for each additional 2 digits of precision,
up to a maximum of 17 bytes.

My question is, the int and smallint ocupy 2 and 4 bytes respectivaly.
Nevertheless if I want to save up to 2 147 483 648 units in a record, and if
a use the numeric(10,0), this will ocupy 6 bytes, with int only 4 ! What
does exactly the manual means with «...numeric and decimal columns is
packed to conserve disk space...» ?

This may seem not important (after all it's only 2 bytes), but with tables
that have several millions of rows, this can mean 200 or more Mb (in my

Something, else, does anybody know why it is impossible to use the integer
datatype on IDENTITY columns ?


Luis Cordeiro