Adding a column with DataType VarBinaryMax using SMO

I have discovered that the following code does not behave as expected…

Table someTable = database.Tables["some_table"];
Column someColumn = new Column (someTable, "some_column", DataType.VarBinaryMax);
someTable.Columns.Add(someColumn);
someTable.Alter();

This code will actually add a column of type varbinary(1) to the database. The following works…

Column someColumn = new Column (someTable, "some_column", DataType.VarBinary(-1));

Oh well.

About Adam

Comments

One Response to “Adding a column with DataType VarBinaryMax using SMO”

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!