Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Drop Existing Column on Database

Author  Topic 

dbalearner
Constraint Violating Yak Guru

272 Posts

Posted - 2011-06-01 : 18:51:00

Msg 5074, Level 16, State 1, Line 1
The index 'SQl_FIX_IDX01' is dependent on column 'FixTranID'.
Msg 4922, Level 16, State 9, Line 1
ALTER TABLE DROP COLUMN FixTranID failed because one or more objects access this column.


This is the error. Can you specify what would be the solution.

Many Thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-06-01 : 19:13:40
You need to drop the index first as the error message indicates.

DROP INDEX TableName.SQl_FIX_IDX01
GO
ALTER TABLE TableName DROP COLUMN FixTranID
GO

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-06-01 : 19:14:07
And if that index has other columns in it, you should consider adding it back but without that column unless you know this index is not needed.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

dbalearner
Constraint Violating Yak Guru

272 Posts

Posted - 2011-06-01 : 19:40:44
Thanks Tara for exclusive reply

But I have executed the above statements as indicated in the first but while adding them to the rest of the columns it complains.

Which is I have dropped the index and then dropped the column - success;

then I have to add this index to work since this index 'SQl_FIX_IDX01' has other columns being supported. while re-adding these columns it complains.

I have re-created the same index on the columns excluding the column that was NOW dropped, so I have to add the same index for the rest of the columns then it is complaining unable to add them.

Thnaks for your patience in reading.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-06-01 : 19:44:52
You'll need to post the error for us to help with your new problem.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

dbalearner
Constraint Violating Yak Guru

272 Posts

Posted - 2011-06-01 : 19:59:30
Thanks Tara I found the Error as this is inter joined with other Columns as they need to be dropped then altogether RECREATE worked out.

Many Thanks
Go to Top of Page
   

- Advertisement -