Back to basics - Storage for a INT column that has NULL

  • Gurus-

    I have a basic question.  If I have an INT column in a table that is nullable, and if I leave it NULL, will it still use 4 bytes?

    Appreciate your responses

  • Yes

  • And that was a basic answer

  • Thanks guys

  • I might be wrong, ( i left my inside sql server 2000 book at work ) but I think if that is you only nullable column it will actually add 5 bytes to the row length.  If I remember correctly, sql server uses a bit array to store the nullability state of each column, but only if there are nullable columns.

     

    Ian Dundas
    Senior IT Analyst - Database
    Manitoba Public Insurance Corp.

  • Not exactly, the NULL bitmap is always there, even if no column allows for NULL.

     

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply