Resize varchar column which is used in one or more indices
Posted on 2015-01-27
I've got a client whose database I am attempting to update and modify some SQL Server tables.
One of the fields which exists in about a dozen SQL Server tables, and which is included in one or more clustered or unclustered indices in each of these tables needs to be resized from varchar(6) to nvarchar(10). But when I tried to simply alter the columns data type and width, I got an error indicating that an index is dependent on the column.
Is there an easy way to drop the index, modify the column structure, then recreate the index? If I could do this as a SP and simply pass in the name of the table, that would be even better.