Alter Table... Alter Column Restrictions
It is not possible to ALTER TABLE…ALTER COLUMN...if any of the following conditions are met:
• The column is or is part of the primary table structure
• The column is or is part of an index
• The column is used in table partitioning
• The column is used in any of the following constraints:
– Primary
– Unique
– Foreign Key
To resolve the problem caused by any of the above, it is necessary to:
• For constraints: Drop the constraints, then alter the column, then replace the constraints.
• For indexes: Drop the indexes, then alter the column, then replace the indexes.
• For primary table structure: Modify the table to heap, then alter the column, then modify the table back to the required structure.
Note: Any indexes and/or constraints on the table need to be handled accordingly.