bcp_collen (ODBC)
Sets the program variable data length for the current bulk copy into Microsoft® SQL Server™.
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 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 the one that results in the least amount of 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 program variable data length for a particular column when copying data to SQL Server with bcp_sendrow.
Initially, the program variable data length is determined when bcp_bind is called. If the program variable 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
(c) 1988-98 Microsoft Corporation. All Rights Reserved.