Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How are NULL values stored

Status
Not open for further replies.

GysE

Programmer
Jun 21, 2002
16
0
0
ZA
We want to know what the impact of NULL values is on physical space sizes on the disk.
Is there any documentation to prove when you got an INT value and you store a NULL value in there that it will still take up 4 bytes.
 
Hi,

As far as I know an INT column will take up 4 bytes whether or not it is NULL or a value. There is a storage engine overhead in allowing NULLs as SQL Server keeps a bitmap for each row indicating which nullable columns actually are NULL. If NULLs are allowed SQL Server must decode this bitmap for every row accessed.

(see "Inside Microsft SQL Server 2000 by Delaney p.235)

Nathan

 
Check the BOL, search the index for 'data types-SQL Server, field length'. The default value for int (native format) is 4 characters (and nullable data is the same length as non-nullable data).

-SQLBill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top