Nice simple question for the db guys,
Its not terribly important but im curious.
Is there something smaller (numeric) that is smaller than a tinyint.
Im storing 120 different values and nearly all of them are going to be (0-9).
A tinyint is the smallest I can find and it hold a value of upto 255. (3 digits)
DB:
Im using MSSqlServer 2008 version 10.00.1600
Numerically
tinyintis likely as small as you can go (it really depends on the database engine you are using). You could usechar(1)and then rely on implicit conversion to query the values but that would be needless overhead to solve a problem that doesn’t really need solving. Also,char(1)is still going to consume 1 byte, 8 bits, which ranges 0-255. I would consider this a micro-optimization and not worth the time/effort.I know you are probably asking for academic purposes, but in terms of database storage,
tinyintis small enough for almost all situations. If you are that concerned about space consumption, I would say you need to look at other options than a traditional RDBMS.