I have a text file that I need to import using BCP. Lots of fields. The column delimiter is a comma while the row terminator is a carriage return. Here is the command that I am using:
The problem I am running into is that some fields have a carriage return \r\n in them and are causing the import grief. I am getting the following error:
SQLState = S1000, NativeError = 0 Error = [Microsoft][SQL Server Native Client 10.0]Unexpected EOF encountered in BCP data-file.
I tried a format file with the column delimiter and row delimiter specified too and nothing seems to work.
Any suggestions?
Thank you in advance for your consideration and time!
can this be fixed at source? that would be best bet otherwise you've to parse individual lines and cleanse unwanted intermediate carriage returns before you do bcp. This can cause performance impact esp if file is huge
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/
Thank you for your response. It is a vendor file and cleaning it at the source is not an option at this time. In the future that may be however it is not now. Luckily the file is not large and the processing-intensive option seems to be all that is available.
then you can make use of script task in SSIS to parse individual rows and cleanse out carriage return . then use BULK INSERT or data flow task task to get data onto your table.
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/