OLE DB Programmer's Reference | |
Drops a constraint from a base table.
HRESULT DropConstraint( DBID *pTableID, DBID *pConstraintID);
Parameters
- pTableID
- [in]
A pointer to the DBID of the table from which to drop the constraint. - pConstraintID
- [in]
A pointer to the DBID of the constraint to drop.
Return Code
- S_OK
- The method succeeded, and the constraint was dropped from the base table.
- E_FAIL
- A provider-specific error occurred.
- E_INVALIDARG
- pTableID or pConstraintID was a null pointer.
- DB_E_BADTABLEID
- The constraint specified in *pConstraintID does not exist in the table specified in *pTableID.
- DB_E_DROPRESTRICTED
- The provider could not drop the constraint because there were one or more table constraints dependent on pConstraintID.
- DB_E_NOCONSTRAINT
- pConstraintID did not exist in the data store.
- DB_E_NOTABLE
- The specified table does not exist in the data store.
- DB_E_TABLEINUSE
- The specified table was in use, and the provider could not drop the constraint as a result.
- DB_SEC_E_PERMISSIONDENIED
- The consumer did not have sufficient permission to drop the constraint.
- 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 ITableDefinitionWithConstraints::DropConstraint returns any errors, the constraint 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.
See Also
ITableDefinitionWithConstraints::AddConstraint
1998-2001 Microsoft Corporation. All rights reserved.