Skip to Content.
Sympa Menu

freetds - [freetds] Problem with freebcp and fixed text output

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Modesto Sevilla <mpsevill AT uci.edu>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] Problem with freebcp and fixed text output
  • Date: Tue, 04 Aug 2009 16:37:39 -0700


Hello,
I am evaluating freebcp as a replacement to bcp (Sybase) while connecting to MS Sql Server 2008. My problem is that when I bcp out a table even if I specify a format file, the output does not come out in fixed length as it did with bcp.
Here is an example:

Table:
create table testbcp
(
term_code char(3) NOT NULL,
cbs_term_code char(6) NOT NULL,
description char(10) NULL,
last_update_date datetime NULL
)

Format file:
10.0
4
1 SYBCHAR 0 3 "" 1 term_code
2 SYBCHAR 0 6 "" 2 cbs_term_code
3 SYBCHAR 0 10 "" 3 description
4 SYBCHAR 0 24 "\n" 4 last_update_date

Output when calling freebcp testbcp out testbcp.dat -f testbcp.fmt -S SERVER -U USERNAME -P PW

093200901TESTING DE
094200902TEST2009-08-04 16:28:11.780
092200906NO DESC2009-08-04 16:28:11.780

But it should be fixed length like this:
093200901TESTING DE
094200902TEST 2009-08-04 16:28:11.780
092200906NO DESC 2009-08-04 16:28:11.780

For some reason it is not padding with spaces according to the format file like the Sybase bcp tool does.
Can anyone help me?







Archive powered by MHonArc 2.6.24.

Top of Page