Transact-SQL Reference

DBCC CLEANTABLE

Reclaims space for dropped variable length columns and text columns.

Syntax

DBCC CLEANTABLE
    ( { 'database_name' | database_id }
        , { 'table_name' | table_id | 'view_name' | view_id }
        [ , batch_size ]
    )

Arguments

'database_name' | database_id

Is the database in which the table to be cleaned belongs.

'table_name' | table_id | 'view_name' | view_id

Is the table or view to be cleaned.

batch_size

Is the number of rows processed per transaction. If not specified, the statement processes the entire table in one transaction.

Remarks

DBCC CLEANTABLE reclaims space after a variable length column or a text column is dropped using the ALTER TABLE DROP COLUMN statement. It does not reclaim space after a fixed length column is dropped.

DBCC CLEANTABLE runs as one or more transactions. If a batch size is not specified, the statement processes the entire row in one transaction. For some large tables, the length of the single transaction and the log space required may be too much. If a batch size is specified, the statement runs in a series of transactions, each including the specified number of rows. DBCC CLEANTABLE cannot be run as a transaction inside another transaction.

This operation is fully logged.

DBCC CLEANTABLE is not supported for use on system tables or temporary tables.

Result Sets
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
Permissions

DBCC CLEANTABLE permissions default to members of the sysadmin fixed server role, the db_owner and db_ddladmin fixed database roles, and the table owner.