Consider I've column VARCHAR(MAX)
. What if I change it to VARCHAR(500)
will Microsoft SQL Server will decrease the size claimed by table?
If you got any link just comment it. I'll check it out.
Update:
I've tested following two case with table.
- ALTER column size
- Create new table and import data from old table.
Initial Table size
ALTER TABLE table_transaction ALTER COLUMN column_name VARCHAR(500)
After ALTER column, table size is incresed
Create new table with new column size and import data from old table
I've taken care of Index in new table.
Why table size is increased in case of ALTER COLUMN
. Ideally table size should decrease.
After performing de-fragmentation on PK
in original table few MB decreased. However its not promising like creating new table.