Skip to content

Latest commit

 

History

History
46 lines (34 loc) · 1.74 KB

File metadata and controls

46 lines (34 loc) · 1.74 KB
title Remove column from SQL Server table (Native Client OLE DB provider)
description Removing a Column from a SQL Server Table (Native Client OLE DB provider)
author markingmyname
ms.author maghan
ms.date 03/14/2017
ms.service sql
ms.subservice native-client
ms.topic reference
helpviewer_keywords
columns [OLE DB]
removing columns
DropColumn function
SQL Server Native Client OLE DB provider, columns

Removing a Column from a SQL Server Table (Native Client OLE DB provider)

[!INCLUDESQL Server Azure SQL Database Synapse Analytics PDW]

The [!INCLUDEssNoVersion] Native Client OLE DB provider 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.

Example

Code

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);  

See Also

Tables and Indexes