Why doesn't SSIS recognize line feed {LF} row delimiter while importing UTF-8 flat file?

43,199

Answer above seems awfully complicated, just convert the line endings in the file

Dim FileContents As String = My.Computer.FileSystem.ReadAllText("c:\Temp\UnixFile.csv")

Dim NewFileContents As String = FileContents.Replace(vbLf, vbCrLf)

My.Computer.FileSystem.WriteAllText("c:\temp\WindowsFile.csv", NewFileContents, False, New System.Text.UnicodeEncoding)

Rehashed from here

Share:
43,199
Rishabh
Author by

Rishabh

mostly use ms sql and .net

Updated on October 23, 2020

Comments

  • Rishabh
    Rishabh over 3 years

    I am trying to import data from a utf-8 encoded flat file into SQL Server 2008 using SSIS. This is what the end of the row data looks like in Notepad++:

    enter image description here

    I have a couple more images showing what the file connection manager looks like:

    enter image description here

    enter image description here

    You can see that the data shows correctly in the file connection manager preview. When I try to import this data, no rows import. I get an error message indicating that the row delimiter was not found. You can see in the file connection manager images that the header row delimiter and the row delimiter are both set to {LF}. This was sufficient to generate the correct preview, so I am lost to why it did not work to import. I have tried a number of things that have brought zero results:

    • Tried using the Wizard import in SSMS...same results
    • Tried using data conversion, no impact
    • Tried setting the row delimiter to (0a), same results

    [Flat File Source [582]] Warning: The end of the data file was reached while reading header rows. Make sure the header row delimiter and the number of header rows to skip are correct.

    Thanks for looking at this and I really appreciate any help you can offer.