MS-SQL Error on removing a column using SMO

Asked By 0 points N/A Posted on -

Hi guys,

I am trying to figure out why I can add a column to a table using SMO, but when I try and remove a column, I get an error which indicates the following:

You cannot perform operation Remove on an object in state Existing. (Microsoft.SqlServer.Smo)

That makes no sense. Surely when you remove a column, the state is Existing.

The code used to add and remove is as follows:



I did a little searching on this but could not get any solution. Does anybody have some clues?

Waiting for reply.