freebcp failing silently with format file that (tries to) remove double quotes
Ajmer Dhariwal <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <CA+K8ZfbdCoRWyP-WRO0A3pyw8PuPU-c5RJGu-o1t3OJ+E8hq+Q@mail.gmail.com> |
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.
_______________________________________________
FreeTDS mailing list
[email protected]
http://lists.ibiblio.org/mailman/listinfo/freetds
test_emails.fmt
(application/octet-stream, 306 B) - not displayed
test_emails.csv
(text/csv, 78 B)
"[email protected]","","user_1001","" "[email protected]","","user_1002",""
test_emails.fmt
(application/octet-stream, 392 B) - not displayed