Adding a Column to a SQL Server Table

OLE DB and SQL Server

OLE DB and SQL Server

Adding a Column to a SQL Server Table

SQLOLEDB exposes the ITableDefinition::AddColumn function, allowing consumers to add a column to a Microsoft® SQL Server™ 2000 table.

When adding a column to a SQL Server 2000 table, the SQLOLEDB consumer is constrained as follows:

  • If DBPROP_COL_AUTOINCREMENT is VARIANT_TRUE, DBPROP_COL_NULLABLE must be VARIANT_FALSE.

  • If the column is defined with the SQL Server 2000 timestamp data type, DBPROP_COL_NULLABLE must be VARIANT_FALSE.

  • For any other column definition, DBPROP_COL_NULLABLE must be VARIANT_TRUE.

Consumers specify the table name as a Unicode character string in the pwszName member of the uName union in the pTableID parameter. The eKind member of pTableID must be DBKIND_NAME.

The new column name is specified as a Unicode character string in the pwszName member of the uName union in the dbcid member of the DBCOLUMNDESC parameter pColumnDesc. The dbcid eKind member must be DBKIND_NAME.

See Also

ALTER TABLE