bcp_collen

Sets the program variable data length for the current bulk copy into SQL Server.

Syntax

RETCODE bcp_collen (
PDBPROCESS
dbproc,
DBINT
varlen,
INT
table_column );

where

dbproc
Is the DBPROCESS structure that is the handle for a particular workstation/ SQL Server process. It contains all the information that DB-Library uses to manage communications and data between the workstation and SQL Server.
varlen
Is the length of the program variable, which does not include the length of the length prefix or terminator. Setting varlen to 0 signifies that the data is NULL. Setting it to -1 signifies that the data is variable length and that the length is determined by the length prefix or terminator. If both a length prefix and a terminator exist, bcp uses the one that results in the shortest amount of data being copied.
table_column
Is the column in the SQL Server table to which the data is copied. Column numbers start at 1.

Returns

SUCCEED or FAIL.

Remarks

The bcp_collen function allows you to change the program variable data length for a particular column while running a copy IN through calls to bcp_bind.

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 you just set.

There must be a separate bcp_collen call for every column in the table whose data length you want to modify.

See Also

bcp_bind, bcp_colptr, bcp_sendrow