Bulk Copy Error: Received Invalid Row Length X From Bcp Client. Minimum Row Size Is Y
Jul 23, 2005Hi,
I am attempting a bulk copy from a c program into SQL Server 2000 using
DBLib in freeTDS 0.63 RC11 (gcc 3.4.3, RH 9). I am getting an error message
that I cannot find any documentation on.
The server is sending back the following: "Received invalid row length 2
from bcp client. Minimum row size is 4."
I know the row is longer 2 bytes (see below). Once this happened I created a
test table and C program. See below. Anyone with any ideas?
Thanks
Program output ---------------->
$ ./test_bcp
bcp'ing This is a test with a length of 14
sent
Msg 4807, Level 16, State 1
Server 'CENTIVIA_10', Line 1
Received invalid row length 2 from bcp client. Minimum row size is 4.
done
<----------------------
Table ddl --------------------->
CREATE TABLE [xxx] (
[col2] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
<------------------------------------
Compiled using gcc ------------------->
gcc -g -I/home/test_user/dev/freetds-0.63RC11/include -Wall -Wno-strict-aliasing
-g -O2 -c -o test_bcp.o test_bcp.c
gcc -o test_bcp test_bcp.o -L/home/test_user/lib -lsybdb
<----------------------------------
program source (included the msg and error handler
code) -------------------------->
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <sqldb.h>
int
syb_msg_handler(DBPROCESS * dbproc, DBINT msgno, int msgstate, int severity,
char *msgtext, char *srvname, char *procname, int line)
{
char var_value[31];
int i;
char *c;
if (msgno == 5701 || /* database context change */
msgno == 5703 || /* language changed */
msgno == 5704) { /* charset changed */
if (msgtext != NULL && (c = strchr(msgtext, ''')) != NULL)
{
i = 0;
for (++c; i <= 30 && *c != '