Wednesday, August 8, 2012

Changing column type for a table with clustered index

Suppose you have a very large table with more than 2 million row. Now you need to change a column datatype (say bigint to smallint). 
Now, if the column you are changing is part of the clustered index definition, then you have to rebuild the clustered index. 
Any non-clustered indexes involving that column will have to be rebuilt when you change the column type, also.
If this table is a heap and does not have a clustered index than you you have to rebuild nothing.

No comments:

Post a Comment