freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: Michael Peppler <mpeppler AT peppler.org>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] bcp CHAR behavior
- Date: Fri, 16 Apr 2004 07:53:02 -0700
On Thu, 2004-04-15 at 19:41, James K. Lowden wrote:
> src/dblib/bcp.c:1107:
>
> if (desttype == SYBVARCHAR) {
> bcpcol->data_size =
> _bcp_rtrim_varchar((char *) bcpcol->data, converted_data_size);
> } else {
> bcpcol->data_size = converted_data_size;
> }
>
> I ran across what might be a little bug in the above code today. I was
> loading a tab-delimited file; column two in the table was a char(2).
FYI - here's what Sybase's bcp does:
create table fts_char(c1 char(20), c2 varchar(20));
cat /tmp/fts_char.bcp
ABC CDE
ABC CDE
Actual data getting sent (checked via Ribo)
Raw PDU Data
Unformatted Contents [64]:
0x1E00010041424320202020202020202020202020202020201E00434445021B181E00010041424320202020202020202020202020202020201E00434445021B18
Note that the char(20) column is *padded* to the correct width, while
the varchar() column is trimmed. I suspect that you will have to become
a little more precise for char() columns, and either pad or truncate as
needed to match the target column's width.
I've got the full Ribo trace of the session, if you want.
Michael
--
Michael Peppler Data Migrations, Inc.
mpeppler AT peppler.org http://www.peppler.org/
Sybase T-SQL/OpenClient/OpenServer/C/Perl developer available for short or
long term contract positions - http://www.peppler.org/resume.html
-
[freetds] bcp CHAR behavior,
James K. Lowden, 04/15/2004
-
Re: [freetds] bcp CHAR behavior,
Michael Peppler, 04/16/2004
- Re: [freetds] bcp CHAR behavior, James K. Lowden, 04/16/2004
-
Re: [freetds] bcp CHAR behavior,
Michael Peppler, 04/16/2004
Archive powered by MHonArc 2.6.24.