How do rename and remove columns in a MS SQL table?
Posted on 2010-09-15
I'm using the Server Management Objects library to alter a table.
My code for adding a column works fine, but whenever I try to rename a column, I get "SetName failed for Column '[columnName]'."
Likewise, my attempts to remove a column are met with "The Column '[columnName]' does not exist on the server."
All I'm doing are:
tbl.Columns[oldName].Name = newName;
Another error that I've gotten when I attempt to remove columns is "You cannot perform operation Remove on an object in state Existing."