What is “Null”? How much space “Null” value takes in SQL Server?


Null is neither zero nor empty string. Null is not a value at all. Most importantly for our discussion, one null value does not equal any other null value. In the RDBMS, Null simply means a value that is not known.

NULL value can occupy in the database based on the coulumn data type and width.

Fixed length data type NULL value takes the space as width of filed. (Char (5) – NULL value take 5 bytes)
Variable length data type NULL value takes 2 bytes. (varChar (5) – NULL value take 2 bytes)
Integer data type null value takes 4 bytes space

You can use the sparse columns to save the space of NULL values. http://technet.microsoft.com/en-us/library/cc280604.aspx

Advertisements

Thanks for the comment, will get back to you soon... Jugal Shah

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s