Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cannot alter column when index exist

Status
Not open for further replies.

kelon

Programmer
May 7, 2002
4
CA
Hi all,

I'm trying to change the "Allow Nulls" property of a field to NOT NULL using

ALTER TABLE tablename ALTER COLUMN fieldname varchar(7) NOT NULL

But since there's an index that's dependent on the field, it returns with an ERROR. However, when I try to do this manually through the Design Table, I can check off that property.

Anybody know how I can make this work without going through the Enterprise Manager? Thanks!

PS- This is in SQL 2000
 
The error message basically said that it can't perform the operation because an index was dependent on the field. The table was clear when I tried running the operation.

I actually got around this by dropping the index and then recreating the index after the alter column. Kinda cheesy though.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top