Skip to Content.
Sympa Menu

freetds - [freetds] freebcp failing silently with format file that (tries to) remove double quotes

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Ajmer Dhariwal <ajmer.dhariwal AT salecycle.com>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] freebcp failing silently with format file that (tries to) remove double quotes
  • Date: Tue, 17 Mar 2015 12:40:33 +0000

I have an input csv file that has every column quoted in double quotes ("").
I have simplified the problem down to a two row csv file.
There are 4 columns and two are empty.
I am using the format file to strip out the quotes by specifying the quotes
as separators and I just can't get it to work - it fails silently with no
output or errors
The format file works fine
I then decided to copy the format file to my Windows 7 desktop and tried
the exact same thing via bcp and it worked fine - the data hit the target
table with the quotes stripped. Obviously, they're using completely
different mechanisms but I would have expected the format files to behave
similarly.
In my own experimentation I can change the separator and make the
corresponding changes to the format file and it works fine but I was
wondering if anyone had tackled a similar issue because I cannot change the
quoting in some of the input files.

I'm escaping the quotes via \"

Format file and sample csv with dummy data are attached.
Data is being exported from the 4 col csv file into a simple two col table
consisting of nvarchar(30) and nvarchar(80) respectively (SQL Server 2012).

freebcp version $Id: freebcp.c,v 1.59 2011/03/13 21:32:49 jklowden Exp $

Keep up the good work by the way - freetds and freebcp are lifesavers!

Thanks,
Ajmer

Ajmer DhariwalDatabase Architect /DBA
.







.Chase House, 4 Mandarin Road, Rainton Bridge, DH4 5RA.

Attachment: test_emails.fmt
Description: Binary data

"fred AT blahblah.com","","user_1001",""
"barney AT blahblah.com","","user_1002",""

Attachment: test_emails.fmt
Description: Binary data



  • [freetds] freebcp failing silently with format file that (tries to) remove double quotes, Ajmer Dhariwal, 03/17/2015

Archive powered by MHonArc 2.6.24.

Top of Page