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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Null Value

Status
Not open for further replies.

wg26

Programmer
Mar 21, 2002
135
US
Hi Everyone:

Can anyone please tell me if Null value in the column will take up the whole bytes, which the column data type will allocate. Say I have a column which has data type float (8 bytes),if this column is Null, does SQL allocate 8 bytes to hold this Null value,or does it just allocate smaller bytes? Thanks alot.
 
A consultant told me once that NULL will take no bytes at all in numeric/float fields. Basically he said that if there's a zero instead of a NULL in a number-type field, the field for that record will take up all the bytes that the data type dictates (eg 4 bytes for an INT data type). If there's a NULL the overall byte length of that row will be smaller.

If I remember correctly, this doesn't apply to CHAR data types - ie a CHAR(8) entry will take up 8 bytes whether it contains a NULL or not.

Take what I say with a pinch of salt though, as I could be wrong!

Hope it helps

Maria
 
Thank you very much Maria.

I have created a table and tested it...It seems to me that Null value does take some bytes. I don't know if it takes whole bytes though...but it is true that overall byte length of the row is smaller with Null value than with a default value of whatever the data type is...

Once again, thank you for your kindly reply...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top