Tuesday, May 02, 2006

How are bit columns stored by the SQL Server?

How are bit columns stored by the SQL Server storage engine?

1. Each field is stored as an 8-bit integer.
2. All bit columns are stored together in 8-bit(byte) groups.

3. Bit columns are stored the same as varbinary columns.
4. All bit columns are stored together in two contiguous bytes since SQL Server only allows 16 bit columns in a row. 5. Each bit column is stored in its respective place in the row as a single bit.


Answer:
2. Microsoft® SQL Server™ optimizes the storage used for bit columns. If there are 8 or fewer bit columns in a table, the columns are stored as 1 byte. If there are from 9 through 16 bit columns, they are stored as 2 bytes, and so on.

No comments: