freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
Re: [freetds] Problem with freebcp and fixed text output [NC]
- From: Konrad J Hambrick <konrad AT payplus.com>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] Problem with freebcp and fixed text output [NC]
- Date: Thu, 06 Aug 2009 17:03:28 -0500
hmmm ...
I wonder if that same FORMAT File works in Windows
using BCP.EXE ?
I'm fairly certain it would with the extra columns
I described below.
Not so sure it would work without the 'placeholders'.
-- kjh
Cedric ROUVRAIS wrote:
Well, not in sybase for sure. This is an app that is running in production
on Sybase and that we are moving to SQL Server.
So I modified bcp.c as follows:
/** Cedric: support for none mapped columns, Sybase style. */
if (whichcol == TAB_COLNUM) {
ci->tab_colnum = 0;
whichcol = NO_MORE_COLS;
}
/** /Cedric */
if (whichcol == NO_MORE_COLS)
return (TRUE);
else
return (FALSE);
And tada it works for :o)
a++ Cedric
|------------------------------ | Konrad J Hambrick | <konrad AT payplus.c | om> | Sent by: | freetds-bounces@l | ists.ibiblio.org | | | 08/06/2009 05:53 | PM | | | Please respond to | konrad AT payplus.co | m; 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]
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,whereas
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
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]
to
Cedric ROUVRAIS wrote:
The issue one of my teams reported is that if there is a column in theI don't know what you mean by "not present", Cedric. It's an integer; it
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?
has to be present.
It looks OK to me. The dbproc->hostfileinfo->host_columns array points
a memory allocated with calloc(3) in bcp_columns(). By default, then,intended
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,
solely for the addressee(s), and may contain legally privilegedinformation.
Any unauthorised use or dissemination is prohibited. E-mails aresusceptible
to alteration. Neither SOCIETE GENERALE nor any of its subsidiaries orfalsified.
affiliates shall be liable for the message if altered, changed or
*************************************************************************_______________________________________________
_______________________________________________
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
*************************************************************************
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] Problem with freebcp and fixed text output,
Modesto Sevilla, 08/04/2009
-
Re: [freetds] Problem with freebcp and fixed text output,
James K. Lowden, 08/05/2009
- Re: [freetds] Problem with freebcp and fixed text output [NC], Cedric ROUVRAIS, 08/06/2009
-
Re: [freetds] Problem with freebcp and fixed text output [NC],
Cedric ROUVRAIS, 08/06/2009
-
Re: [freetds] Problem with freebcp and fixed text output [NC],
James K. Lowden, 08/06/2009
-
Re: [freetds] Problem with freebcp and fixed text output [NC],
Cedric ROUVRAIS, 08/06/2009
-
Re: [freetds] Problem with freebcp and fixed text output [NC],
Konrad J Hambrick, 08/06/2009
- Re: [freetds] Problem with freebcp and fixed text output [NC], Konrad J Hambrick, 08/06/2009
-
Re: [freetds] Problem with freebcp and fixed text output [NC],
Cedric ROUVRAIS, 08/06/2009
- Re: [freetds] Problem with freebcp and fixed text output [NC], Konrad J Hambrick, 08/06/2009
-
Re: [freetds] Problem with freebcp and fixed text output [NC],
Konrad J Hambrick, 08/06/2009
-
Re: [freetds] Problem with freebcp and fixed text output [NC],
Cedric ROUVRAIS, 08/06/2009
-
Re: [freetds] Problem with freebcp and fixed text output [NC],
James K. Lowden, 08/06/2009
- <Possible follow-up(s)>
- Re: [freetds] Problem with freebcp and fixed text output, rodrigo lopez, 08/05/2009
-
Re: [freetds] Problem with freebcp and fixed text output,
James K. Lowden, 08/05/2009
Archive powered by MHonArc 2.6.24.