title | description | author | ms.author | ms.date | ms.service | ms.subservice | ms.topic | helpviewer_keywords | ||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Remove column from SQL Server table (OLE DB driver) |
The OLE DB Driver for SQL Server exposes the ITableDefinition::DropColumn function, which allows consumers to remove a column from a SQL Server table. |
David-Engel |
davidengel |
06/14/2018 |
sql |
connectivity |
reference |
|
[!INCLUDE SQL Server]
[!INCLUDEDriver_OLEDB_Download]
The OLE DB Driver for SQL Server exposes the ITableDefinition::DropColumn function. This allows consumers to remove a column from a [!INCLUDEssNoVersion] table.
Consumers specify the table name as a Unicode character string in the pwszNamemember of the uName union in the pTableID parameter. The eKindmember of pTableID must be DBKIND_NAME.
The consumer indicates a column name in the pwszNamemember of the uName union in the pColumnID parameter. The column name is a Unicode character string. The eKind member of pColumnID must be DBKIND_NAME.
DBID TableID;
DBID ColumnID;
HRESULT hr;
TableID.eKind = DBKIND_NAME;
TableID.uName.pwszName = L"MyTableName";
ColumnID.eKind = DBKIND_NAME;
ColumnID.uName.pwszName = L"MyColumnName";
hr = m_pITableDefinition->DropColumn(&TableID, &ColumnID);