Microsoft KB Archive/113081

{|
 * width="100%"|

BUG: bcp_init Fails if DBBUFFER Is Set Too Low

 * }

Q113081

-

The information in this article applies to:


 * Microsoft SQL Server Programmer's Toolkit, version 4.2

-

BUG# 9920 (4.2)

SYMPTOMS
A call to the DB-Library (DB-Lib) function bcp_init fails with no error messages generated.

CAUSE
Bcp_init will fail to process correctly if the DBBUFFER value, set by calling dbsetopt, was set to a value equal to or less than the number of columns in the table that bcp_init is referencing.

For example, assume you have a table defined as:

  CREATE TABLE test (col1 int, col2 int, col3 int)

bcp_init will fail if the following call to dbsetopt was made in the application:

  dbsetopt (dbproc, DBBUFFER, "3");

WORKAROUND
This problem can be avoided by either increasing the DBBUFFER value to a value greater than the number of columns, using the example above setting the value to 4 would resolve the problem:

  dbsetopt (dbproc, DBBUFFER, "4");

Another option is to simply not set the DBBUFFER value as it is not used in DB-Library applications that are writing to the BCP API.

STATUS
Microsoft has confirmed this to be a problem in DB-Library version 4.20.00. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

Additional query words: bulk-copy dblib

Keywords : kbtool

Issue type :

Technology : kbSQLServSearch kbAudDeveloper kbSQLServPTK420