Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SQL server storage Q

Author  Topic 

aiken
Aged Yak Warrior

525 Posts

Posted - 2004-08-30 : 13:14:38
Ok, something's bugging me. How, exactly, does SQL server store NULLs?

It seems to me that if you had a table with a single tinyint column and 100 rows, it should be 100 bytes. Likewise, a table with a single INT column and 256 rows should be 1K.

However, NULLs should throw all of that off. Byte columns have 257 possible values, smallints have 65537 possible values, ints have 4,294,967,297 possible values -- all one more than the datatype should hold in the number of bytes assigned to it.

So how does that work?

Cheers
-b

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-08-30 : 14:10:08
http://www.nigelrivett.net/PageStructure.html

Tara
Go to Top of Page

aiken
Aged Yak Warrior

525 Posts

Posted - 2004-08-30 : 17:37:27
Bless you. Essentially, one bitmapped byte per row indicating which columns in that row are null. Hence, the 255 column per table limitation (or if not "hence," then at least "similarly,").

Cheers
-b
Go to Top of Page
   

- Advertisement -