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

Ajmer Dhariwal ajmer.dhariwal at salecycle.com
Tue Mar 17 08:40:33 EDT 2015


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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_emails.fmt
Type: application/octet-stream
Size: 305 bytes
Desc: not available
URL: <http://lists.ibiblio.org/pipermail/freetds/attachments/20150317/caeb60cc/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_emails.csv
Type: text/csv
Size: 78 bytes
Desc: not available
URL: <http://lists.ibiblio.org/pipermail/freetds/attachments/20150317/caeb60cc/attachment.csv>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_emails.fmt
Type: application/octet-stream
Size: 391 bytes
Desc: not available
URL: <http://lists.ibiblio.org/pipermail/freetds/attachments/20150317/caeb60cc/attachment-0001.obj>


More information about the FreeTDS mailing list