Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does SQL server compress NULL bit datatypes? [duplicate]

Tags:

sql-server

bit

Possible Duplicate:
Can Microsoft store three-valued fields in a single bit?

According to the documentation for bit, the bit datatype can have three values, 0, 1 and NULL and if there are 8 or less bit columns in a table, those columns will be compressed into one byte.

These two behaviors seem contradictory. If so, which part is correct, the ability of a bit to be NULL or the compression of 8 bits to a byte?

like image 955
kubi Avatar asked Nov 06 '22 02:11

kubi


1 Answers

NULL values are handled by a separate bit for each column (for example look here for details).

like image 103
TToni Avatar answered Nov 09 '22 09:11

TToni