Dash39 (Dash39 (AT) discussions (DOT) microsoft.com) writes:
Quote:
using sql server 2k, I have been importing csv files reliably for months
but have now been sent a new csv file which contains a quoted field
that contains a comma e.g... , "abcd, efgh" , .... No previous files had
any quoted fields. bcp does not like this at all. I have searched but
have not found how to resolve this issue. Any comments or suggestions
will be much appreciated. |
BCP can deal with quoted fields, but the quoting must be applied
consistently. If a field is quoted in one record, but not in the next,
you lose.
BCP works with a stream of bytes, handles both binary files and text files.
Or rather: text files are handled as any other binary file. To use quoted
fields, you need to define your delimiters with the quotes as part of them.
To this end you typically need to use a format file.
--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se
Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx