Thursday, March 22, 2012

Adding a bit column to existing table.

How is storage allocated when an existing table is altered to add a bit
column? I think I read somewhere that the first bit column allocates a byte
and subsequent bit columns are included in that existing byte. Is that true?Snake you must have one hellaciously big table! ;-)
"Snake" <Snake@.discussions.microsoft.com> wrote in message
news:AA6F5E58-5FB6-4E14-A58B-A9F5F648413F@.microsoft.com...
> How is storage allocated when an existing table is altered to add a bit
> column? I think I read somewhere that the first bit column allocates a
> byte
> and subsequent bit columns are included in that existing byte. Is that
> true?|||I'm sorry, but I don't understand your response.
"Jerry Spivey" wrote:
> Snake you must have one hellaciously big table! ;-)
> "Snake" <Snake@.discussions.microsoft.com> wrote in message
> news:AA6F5E58-5FB6-4E14-A58B-A9F5F648413F@.microsoft.com...
> > How is storage allocated when an existing table is altered to add a bit
> > column? I think I read somewhere that the first bit column allocates a
> > byte
> > and subsequent bit columns are included in that existing byte. Is that
> > true?
>
>|||The minimum allocation size used is a byte. A bit column requires one
bit for the NULL-bitmap, and one bit for the data storage. The 1st, 9th,
17th, etc. column that is added (regardless of data type) will allocate
a new byte for the NULL-bitmap. The 1st, 9th, 17th, etc. bit column will
allocate a new byte for the data storage.
Gert-Jan
Snake wrote:
> How is storage allocated when an existing table is altered to add a bit
> column? I think I read somewhere that the first bit column allocates a byte
> and subsequent bit columns are included in that existing byte. Is that true?

No comments:

Post a Comment