Alter fields with indexes
Posted on 2003-12-04
I need to modify the datatypes of all the fields in my database to a new datatype.
nvarchar to varchar, decimal to numeric, datetime to smalldatetime.
I generated alter table scripts for all the tables and modified the datatypes
Now the problem i am facing is fields with indexes. I got some unique indexes set for quite a lot of fields in my database.
The Alter table statement didnot work
I get an error as below
Server: Msg 5074, Level 16, State 8, Line 1
The index 'IDX_Supplier' is dependent on column 'Supplier_Id'.
Server: Msg 4922, Level 16, State 1, Line 1
ALTER TABLE ALTER COLUMN Supplier_Id failed because one or more objects access this column.
Simple solution is to drop the index on this field and re-create them but then i need to generate the scripts and update the same on the live server.