Skip to content

Latest commit

 

History

History
54 lines (40 loc) · 2.53 KB

File metadata and controls

54 lines (40 loc) · 2.53 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic helpviewer_keywords apilocation apiname apitype
bcp_collen
bcp_collen
markingmyname
maghan
03/14/2017
sql
native-client
reference
bcp_collen function
sqlncli11.dll
bcp_collen
DLLExport

bcp_collen

[!INCLUDESQL Server Azure SQL Database Synapse Analytics PDW]

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