Skip to content

Latest commit

 

History

History
37 lines (27 loc) · 2.05 KB

adding-a-column-to-a-sql-server-table.md

File metadata and controls

37 lines (27 loc) · 2.05 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic helpviewer_keywords
Add column to SQL Server table (Native Client OLE DB provider)
Add column to SQL Server table (Native Client OLE DB provider)
markingmyname
maghan
03/14/2017
sql
native-client
reference
columns [OLE DB]
AddColumn function
SQL Server Native Client OLE DB provider, columns
adding columns

Adding a Column to a Table in SQL Server Native Client

[!INCLUDESQL Server Azure SQL Database Synapse Analytics PDW]

The [!INCLUDEssNoVersion] Native Client OLE DB provider exposes the ITableDefinition::AddColumn function. This allows consumers to add a column to a [!INCLUDEssNoVersion] table.

When you add a column to a [!INCLUDEssNoVersion] table, the [!INCLUDEssNoVersion] Native Client OLE DB provider consumer is constrained as follows:

  • If DBPROP_COL_AUTOINCREMENT is VARIANT_TRUE, DBPROP_COL_NULLABLE must be VARIANT_FALSE.

  • If the column is defined by using the [!INCLUDEssNoVersion] 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 eKind member must be DBKIND_NAME.

See Also

Tables and Indexes
ALTER TABLE (Transact-SQL)