views:

23

answers:

1

Hello Guys, May I know why Sparse columns which are having non null values takes 4Bytes of extra space..I am finding out why it is taking 4 bytes of extra space.. Please help me out?

+2  A: 

From MSDN (my bold)

The SQL Server Database Engine uses the SPARSE keyword in a column definition to optimize the storage of values in that column. Therefore, when the column value is NULL for any row in the table, the values require no storage.

The reverse would be NON-null means "always store a value" = bytes used with the following condition:

Sparse columns require more storage space for nonnull values than the space required for identical data that is not marked SPARSE.

.. and the following table in MSDN shows +4 bytes per sparse column

Sorry if this sounds harsh, but what else would you expect?

And a nice summary of SPARSE here

gbn