In a largely experimental attempt to reduce table space usage I altered a char(10)
column to char(3)
(The column's contents are never more than three characters long)
Steps (Not carried out in a single batch)
use thedatabase;
alter table thetable
alter column thecolumn char(3) null
DBCC CLEANTABLE (thedatabase,'thetable', 500000);
/* Apparently not needed for fixed length column but just in case*/
DBCC SHRINKFILE (1);
The operation completed successfully, but the table actually grew in size. I know this can happen due to the way the sql engine modifies a column (creates a copy alongside and then copies the column contents) so I ran dbcc cleantable
on the table, and then dbcc shrinkfile
on the database file. None of these operations made any difference to the table size.
The table has no index, so not possible to run a rebuild index operation.
So my question is, why did the table grow, even after commands to shrink it.