Skip to content

Latest commit

 

History

History
60 lines (46 loc) · 2.86 KB

File metadata and controls

60 lines (46 loc) · 2.86 KB
title bcp_collen | Microsoft Docs
ms.custom
ms.date 03/14/2017
ms.prod sql
ms.prod_service database-engine, sql-database, sql-data-warehouse, pdw
ms.reviewer
ms.technology native-client
ms.topic reference
apiname
bcp_collen
apilocation
sqlncli11.dll
apitype DLLExport
helpviewer_keywords
bcp_collen function
ms.assetid faaf1f7a-81f2-4852-a178-56602c33673a
author markingmyname
ms.author maghan
monikerRange >=aps-pdw-2016||=azuresqldb-current||=azure-sqldw-latest||>=sql-server-2016||=sqlallproducts-allversions||>=sql-server-linux-2017||=azuresqldb-mi-current

bcp_collen

[!INCLUDEappliesto-ss-asdb-asdw-pdw-md]

Sets the data length in the program variable for the current bulk copy into [!INCLUDEssNoVersion].

Syntax

  
RETCODE bcp_collen (  
        HDBC hdbc,  
        DBINT cbData,  
        INT idxServerCol);  

Arguments

hdbc
Is the bulk copy-enabled ODBC connection handle.

cbData
Is the length of the data in the program variable, not including the length of any length indicator or terminator. Setting cbData to SQL_NULL_DATA indicates all rows copied to the server contain a NULL value for the column. Setting it to SQL_VARLEN_DATA indicates that a string terminator or other method is used to determine the length of data copied. If both a length indicator and a terminator exist, the system uses whichever one results in less data being copied.

idxServerCol
Is the ordinal position of the column in the table to which the data is copied. The first column is 1. The ordinal position of a column is reported by SQLColumns.

Returns

SUCCEED or FAIL.

Remarks

The bcp_collen function allows you to change the data length in the program variable for a particular column when copying data to [!INCLUDEssNoVersion] with bcp_sendrow.

Initially, the data length is determined when bcp_bind is called. If the data length changes between calls to bcp_sendrow and no length prefix or terminator is being used, you can call bcp_collen to reset the length. The next call to bcp_sendrow uses the length set by the call to bcp_collen.

You must call bcp_collen once for each column in the table whose data length you want to modify.

See Also

Bulk Copy Functions