Skip to Content.
Sympa Menu

freetds - Re: [freetds] Problem with freebcp and fixed text output [NC]

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Konrad J Hambrick <konrad AT payplus.com>
  • To: konrad AT payplus.com, FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Problem with freebcp and fixed text output [NC]
  • Date: Thu, 06 Aug 2009 16:56:33 -0500


oops.

sorry for the self-followup ..

I believe it also needs at least an empty ("") Column Name
in the FORMAT File, column 7.

Starting with Version 8.0, I believe BCP.EXE also requires
a collation in column 8. Again an empty string is OK ...

-- kjh


Konrad J Hambrick wrote:
Hmmm ...

Does the FORMAT file not need an explicit 0 (zero)
in Column 6 of the 2nd row of the FORMAT file to
skip DB Table Column 2 ?

I believe this is so in MS SQLServer.

-- kjh


Cedric ROUVRAIS wrote:
Hi,

Say you have a file with 100 columns and a table with 10 colums (case for
one of our apps), how do you selectively bcp in the file? With Sybase you
simply do not specify TAB_COLNUM and that column in the file is ignored.

Sample format file (incomplete)

10.0
182
1 SYBCHAR 0 20 ";" 1 id
2 SYBCHAR 0 20 ";"
3 SYBCHAR 0 20 ";" 2 gop

freebcp chokes on the second column (2 SYBCHAR 0 20 ";") and exits whereas
Sybase knows that it just needs to ignore this data, so I am modifying
bcp.c to accomodate this behaviour.

If I understand what you mean

2 SYBCHAR 0 20 ";" 0

would be the appropriate format file and then freebcp would ignore this
field but still bcp the file in?

a++ Cedric



|------------------------------ | "James K. Lowden" | <jklowden@freetds | .org> | Sent by: | freetds-bounces@l | ists.ibiblio.org | | | 08/06/2009 05:39 | PM | | | Please respond to | FreeTDS | Development Group | <freetds AT lists.ib | iblio.org> | | To FreeTDS Development Group <freetds AT lists.ibiblio.org> cc Subject Re: [freetds] Problem with freebcp and fixed text output [NC]



Cedric ROUVRAIS wrote:
The issue one of my teams reported is that if there is a column in the
file that does not get imported into the table, then it fails. The
faulty procedure is _bcp_readfmt_colinfo which fails because TAB_COLNUM
is not present in that case.

Any ideas before I start implementing a fix?
I don't know what you mean by "not present", Cedric. It's an integer; it
has to be present.

It looks OK to me. The dbproc->hostfileinfo->host_columns array points to
a memory allocated with calloc(3) in bcp_columns(). By default, then,
ci->tab_colnum should be zero, meaning the field in the file is ignored.

HTH.

--jkl
_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds



*************************************************************************
This message and any attachments (the "message") are confidential, intended solely for the addressee(s), and may contain legally privileged information. Any unauthorised use or dissemination is prohibited. E-mails are susceptible to alteration. Neither SOCIETE GENERALE nor any of its subsidiaries or affiliates shall be liable for the message if altered, changed or falsified.
*************************************************************************

_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds

_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds





Archive powered by MHonArc 2.6.24.

Top of Page