Home All Groups Group Topic Archive Search About

alter table drop column and dbcc cleantable



Author
1 Jun 2005 3:23 PM
Robert Klemme
All,

I just want to make sure my understanding is correct:

1) alter table drop column does not release space of varchar columns and
other columns of variable length.

2) dbcc cleantable frees this space

Open questions:

3) What about the space used by fixed size columns?  Is it reclaimed
during drop (timing lets me suspect that it's not)?  dbcc cleantable "does
not reclaim space after a fixed length column is dropped."
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_dbcc_4bah.asp

Are rows inserted after a DROP COLUMN smaller?

Thanks a lot!

Kind regards

    robert

Author
2 Jun 2005 3:25 PM
Robert Klemme
Robert Klemme wrote:
Show quoteHide quote
> All,
>
> I just want to make sure my understanding is correct:
>
> 1) alter table drop column does not release space of varchar columns
> and other columns of variable length.
>
> 2) dbcc cleantable frees this space
>
> Open questions:
>
> 3) What about the space used by fixed size columns?  Is it reclaimed
> during drop (timing lets me suspect that it's not)?  dbcc cleantable
> "does not reclaim space after a fixed length column is dropped."
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_dbcc_4bah.asp
>
> Are rows inserted after a DROP COLUMN smaller?
>
> Thanks a lot!
>
> Kind regards
>
>     robert

No one wants to answer this one?  Come on...  I can even offer a virtual
hug. :-)

Thanks!

    robert
Are all your drivers up to date? click for free checkup

Author
6 Jun 2005 4:42 AM
Anthony Thomas
Well, its actually two questions.

1. DBCC CLEANTABLE does not reclaim CHAR and NCHAR columns, nor does the
ALTER TABLE ... DROP COLUMN statement.  Correct.

2. Are the rows inserted after the ALTER TABLE statement has been issued?
Yes, new rows will only occupy the storage required for the new data
definition contingent on the values of PAD_INDEX and FILLFACTOR for the
Clustered Index.

Now, the next logical question would be: how to I reclaim the space after
issue the ALTER TABLE ... DROP COLUMN statement with a fixed-length column?

Rebuild the Clustered Index.

Sincerely,


Anthony Thomas


--

"Robert Klemme" <bob.n***@gmx.net> wrote in message
news:%23ypiPd4ZFHA.2212@TK2MSFTNGP14.phx.gbl...
Robert Klemme wrote:
Show quoteHide quote
> All,
>
> I just want to make sure my understanding is correct:
>
> 1) alter table drop column does not release space of varchar columns
> and other columns of variable length.
>
> 2) dbcc cleantable frees this space
>
> Open questions:
>
> 3) What about the space used by fixed size columns?  Is it reclaimed
> during drop (timing lets me suspect that it's not)?  dbcc cleantable
> "does not reclaim space after a fixed length column is dropped."
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_dbcc_4bah.asp
>
> Are rows inserted after a DROP COLUMN smaller?
>
> Thanks a lot!
>
> Kind regards
>
>     robert

No one wants to answer this one?  Come on...  I can even offer a virtual
hug. :-)

Thanks!

    robert
Author
6 Jun 2005 9:01 AM
Robert Klemme
Anthony Thomas wrote:
Show quoteHide quote
> "Robert Klemme" <bob.n***@gmx.net> wrote in message
> news:%23ypiPd4ZFHA.2212@TK2MSFTNGP14.phx.gbl...
> Robert Klemme wrote:
>> All,
>>
>> I just want to make sure my understanding is correct:
>>
>> 1) alter table drop column does not release space of varchar columns
>> and other columns of variable length.
>>
>> 2) dbcc cleantable frees this space
>>
>> Open questions:
>>
>> 3) What about the space used by fixed size columns?  Is it reclaimed
>> during drop (timing lets me suspect that it's not)?  dbcc cleantable
>> "does not reclaim space after a fixed length column is dropped."
>>
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_dbcc_4bah.asp
Show quoteHide quote
>>
>> Are rows inserted after a DROP COLUMN smaller?
>>
>> Thanks a lot!
>>
>> Kind regards
>>
>>     robert
>
> No one wants to answer this one?  Come on...  I can even offer a
> virtual hug. :-)

> Well, its actually two questions.
>
> 1. DBCC CLEANTABLE does not reclaim CHAR and NCHAR columns, nor does
> the ALTER TABLE ... DROP COLUMN statement.  Correct.

Ok.

> 2. Are the rows inserted after the ALTER TABLE statement has been
> issued? Yes, new rows will only occupy the storage required for the
> new data definition contingent on the values of PAD_INDEX and
> FILLFACTOR for the Clustered Index.

Ok.

> Now, the next logical question would be: how to I reclaim the space
> after issue the ALTER TABLE ... DROP COLUMN statement with a
> fixed-length column?
>
> Rebuild the Clustered Index.

Ok, so basically the space is not reclaimed until either the complete
table is rebuild or old records are deleted.

Thanks a lot!  You get the virtual hug: *hug*
:-)

Kind regards

    robert

Bookmark and Share