Alter Column

  • Hi All..

    I have to change datatype of a column in many tables. Now the problem is the column is a composite key. I have dropped the constraint then tried changing the datatype, server throws back error

    Server: Msg 5074, Level 16, State 8, Line 1

    The statistics 'ABC' is dependent on column 'ABC'.

    Server: Msg 4922, Level 16, State 1, Line 1

    ALTER TABLE ALTER COLUMN ABC failed because one or more objects access this column.

    There are loads of data in many tables. So I have to be sure no data is lost also.

    I have checked in sysreferences no table is referencing this table.

    I am chaniging datatype from smallint to INT.

    Please help.

    Thanks,

    Harsha

  • Drop the index which was created on the column being dropped/modified.

    Also check, may be index was created on coposite key, if its there... drop the index then change the datatype and re-create the index.

  • Hi,

    Thanks for the quick reply and it did help.

    Now a new problem is there...

    With the same column name I have got lots of tables and in sysindexes there are 23 rows with same column name but with different name:(

  • Hi,

    I use the delete statement after sp_configure...

    thanks for the help...

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply