ITableDefinition::DropColumn
Drops a column from the base table.
Syntax
HRESULT DropColumn(
DBID *pTableID,
DBID *pColumnID);
Parameters
pTableID
[in] A pointer to the DBID of the table from which to drop the column.pColumnID
[in] A pointer to the DBID of the column to drop.
Return Code
S_OK
The method succeeded, and the column was dropped from the base table.E_FAIL
A provider-specific error occurred.E_INVALIDARG
pTableID or pColumnID was a null pointer.DB_E_NOCOLUMN
The column specified in *pColumnID does not exist in the specified table.DB_E_DROPRESTRICTED
The provider could not drop the column because pColumnID was referenced in a view definition.The provider could not drop the column because pColumnID was referenced in a constraint belonging to a table other than pTableID.
The provider could not drop the column because pColumnID was referenced, along with one or more other columns, in a constraint definition on pTableID.
DB_E_NOTABLE
The specified table does not exist in the current data store.DB_E_TABLEINUSE
The specified table was in use.DB_SEC_E_PERMISSIONDENIED
The consumer did not have sufficient permission to drop the column.XACT_E_XTIONEXISTS
The provider supports transactional DDL, the session is participating in a transaction, and the value of DBPROP_SUPPORTEDTXNDDL is DBPROPVAL_TC_DML.
Comments
If ITableDefinition::DropColumn returns any errors, the column is not dropped.
If the session is participating in a transaction, if DBPROP_SUPPORTEDTXNDDL is DBPROPVAL_TC_DDL_IGNORE, and if the method succeeds, the operation is complete and is unaffected by subsequent calls to abort or commit the transaction.
If the session is participating in a transaction, if DBPROP_SUPPORTEDTXNDDL is DBPROPVAL_TC_DDL_COMMIT, and if the method succeeds, the transaction is committed without retention. No new transaction is created. Any new work done on the session is outside the scope of a transaction. Attempting to explicitly commit or abort when there is no outstanding transaction returns an error.